Skip to content

Commit cdda107

Browse files
committed
thanks clippy
1 parent 2a13247 commit cdda107

File tree

13 files changed

+45
-44
lines changed

13 files changed

+45
-44
lines changed

gitoxide-core/src/repository/attributes/validate_baseline.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,13 @@ pub(crate) mod function {
305305
}
306306

307307
fn parse_exclude(line: &str) -> Option<(String, Baseline)> {
308-
let (left, value) = line.split_at(line.find(|c| c == '\t')?);
308+
let (left, value) = line.split_at(line.find('\t')?);
309309
let value = &value[1..];
310310

311311
let location = if left == "::" {
312312
None
313313
} else {
314-
let mut tokens = left.split(|b| b == ':');
314+
let mut tokens = left.split(':');
315315
let source = tokens.next()?;
316316
let line_number: usize = tokens.next()?.parse().ok()?;
317317
let pattern = tokens.next()?;
@@ -363,8 +363,8 @@ pub(crate) mod function {
363363
"unspecified" => StateRef::Unspecified,
364364
_ => StateRef::from_bytes(info.as_bytes()),
365365
};
366-
path = path.trim_end_matches(|b| b == ':');
367-
let attr = attr.trim_end_matches(|b| b == ':');
366+
path = path.trim_end_matches(':');
367+
let attr = attr.trim_end_matches(':');
368368
let assignment = gix::attrs::AssignmentRef {
369369
name: gix::attrs::NameRef::try_from(attr.as_bytes().as_bstr()).ok()?,
370370
state,

gitoxide-core/src/repository/index/entries.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ pub(crate) mod function {
319319

320320
#[cfg(feature = "serde")]
321321
fn to_json(
322-
mut out: &mut impl std::io::Write,
322+
out: &mut impl std::io::Write,
323323
index: &gix::index::File,
324324
entry: &gix::index::Entry,
325325
attrs: Option<Attrs>,
@@ -338,7 +338,7 @@ pub(crate) mod function {
338338
}
339339

340340
serde_json::to_writer(
341-
&mut out,
341+
&mut *out,
342342
&Entry {
343343
stat: &entry.stat,
344344
hex_id: entry.id.to_hex().to_string(),

gix-config/src/file/section/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<'a> Section<'a> {
7575
/// Stream ourselves to the given `out`, in order to reproduce this section mostly losslessly
7676
/// as it was parsed.
7777
pub fn write_to(&self, mut out: &mut dyn std::io::Write) -> std::io::Result<()> {
78-
self.header.write_to(&mut out)?;
78+
self.header.write_to(&mut *out)?;
7979

8080
if self.body.0.is_empty() {
8181
return Ok(());

gix-config/src/file/write.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl File<'_> {
1818
pub fn write_to_filter(
1919
&self,
2020
mut out: &mut dyn std::io::Write,
21-
mut filter: &mut dyn FnMut(&Section<'_>) -> bool,
21+
filter: &mut dyn FnMut(&Section<'_>) -> bool,
2222
) -> std::io::Result<()> {
2323
let nl = self.detect_newline_style();
2424

@@ -27,7 +27,8 @@ impl File<'_> {
2727
event.write_to(&mut out)?;
2828
}
2929

30-
if !ends_with_newline(self.frontmatter_events.as_ref(), nl, true) && self.sections.values().any(&mut filter)
30+
if !ends_with_newline(self.frontmatter_events.as_ref(), nl, true)
31+
&& self.sections.values().any(&mut *filter)
3132
{
3233
out.write_all(nl)?;
3334
}

gix-config/src/parse/event.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl Event<'_> {
3333

3434
/// Stream ourselves to the given `out`, in order to reproduce this event mostly losslessly
3535
/// as it was parsed.
36-
pub fn write_to(&self, mut out: &mut dyn std::io::Write) -> std::io::Result<()> {
36+
pub fn write_to(&self, out: &mut dyn std::io::Write) -> std::io::Result<()> {
3737
match self {
3838
Self::ValueNotDone(e) => {
3939
out.write_all(e.as_ref())?;
@@ -42,8 +42,8 @@ impl Event<'_> {
4242
Self::Whitespace(e) | Self::Newline(e) | Self::Value(e) | Self::ValueDone(e) => out.write_all(e.as_ref()),
4343
Self::KeyValueSeparator => out.write_all(b"="),
4444
Self::SectionKey(k) => out.write_all(k.0.as_ref()),
45-
Self::SectionHeader(h) => h.write_to(&mut out),
46-
Self::Comment(c) => c.write_to(&mut out),
45+
Self::SectionHeader(h) => h.write_to(out),
46+
Self::Comment(c) => c.write_to(out),
4747
}
4848
}
4949

gix-config/src/parse/events.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,26 @@ pub type FrontMatterEvents<'a> = SmallVec<[Event<'a>; 8]>;
2828
///
2929
/// For concrete examples, some notable differences are:
3030
/// - `git-config` sections permit subsections via either a quoted string
31-
/// (`[some-section "subsection"]`) or via the deprecated dot notation
32-
/// (`[some-section.subsection]`). Successful parsing these section names is not
33-
/// well defined in typical `.ini` parsers. This parser will handle these cases
34-
/// perfectly.
31+
/// (`[some-section "subsection"]`) or via the deprecated dot notation
32+
/// (`[some-section.subsection]`). Successful parsing these section names is not
33+
/// well defined in typical `.ini` parsers. This parser will handle these cases
34+
/// perfectly.
3535
/// - Comment markers are not strictly defined either. This parser will always
36-
/// and only handle a semicolon or octothorpe (also known as a hash or number
37-
/// sign).
36+
/// and only handle a semicolon or octothorpe (also known as a hash or number
37+
/// sign).
3838
/// - Global properties may be allowed in `.ini` parsers, but is strictly
39-
/// disallowed by this parser.
39+
/// disallowed by this parser.
4040
/// - Only `\t`, `\n`, `\b` `\\` are valid escape characters.
4141
/// - Quoted and semi-quoted values will be parsed (but quotes will be included
42-
/// in event outputs). An example of a semi-quoted value is `5"hello world"`,
43-
/// which should be interpreted as `5hello world` after
44-
/// [normalization][crate::value::normalize()].
42+
/// in event outputs). An example of a semi-quoted value is `5"hello world"`,
43+
/// which should be interpreted as `5hello world` after
44+
/// [normalization][crate::value::normalize()].
4545
/// - Line continuations via a `\` character is supported (inside or outside of quotes)
4646
/// - Whitespace handling similarly follows the `git-config` specification as
47-
/// closely as possible, where excess whitespace after a non-quoted value are
48-
/// trimmed, and line continuations onto a new line with excess spaces are kept.
47+
/// closely as possible, where excess whitespace after a non-quoted value are
48+
/// trimmed, and line continuations onto a new line with excess spaces are kept.
4949
/// - Only equal signs (optionally padded by spaces) are valid name/value
50-
/// delimiters.
50+
/// delimiters.
5151
///
5252
/// Note that things such as case-sensitivity or duplicate sections are
5353
/// _not_ handled. This parser is a low level _syntactic_ interpreter
@@ -62,8 +62,8 @@ pub type FrontMatterEvents<'a> = SmallVec<[Event<'a>; 8]>;
6262
/// # Trait Implementations
6363
///
6464
/// - This struct does _not_ implement [`FromStr`] due to lifetime
65-
/// constraints implied on the required `from_str` method. Instead, it provides
66-
/// [`From<&'_ str>`].
65+
/// constraints implied on the required `from_str` method. Instead, it provides
66+
/// [`From<&'_ str>`].
6767
///
6868
/// # Idioms
6969
///

gix-ignore/src/search.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl Search {
5555
.transpose()?,
5656
);
5757
group.patterns.extend(pattern::List::<Ignore>::from_file(
58-
&git_dir.join("info").join("exclude"),
58+
git_dir.join("info").join("exclude"),
5959
None,
6060
follow_symlinks,
6161
buf,

gix-pack/src/bundle/write/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ impl crate::Bundle {
5151
/// * `progress` provides detailed progress information which can be discarded with [`gix_features::progress::Discard`].
5252
/// * `should_interrupt` is checked regularly and when true, the whole operation will stop.
5353
/// * `thin_pack_base_object_lookup` If set, we expect to see a thin-pack with objects that reference their base object by object id which is
54-
/// expected to exist in the object database the bundle is contained within.
55-
/// `options` further configure how the task is performed.
54+
/// expected to exist in the object database the bundle is contained within.
55+
/// `options` further configure how the task is performed.
5656
///
5757
/// # Note
5858
///

gix-pack/src/cache/delta/from_offsets.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ const PACK_HEADER_LEN: usize = 12;
3131
impl<T> Tree<T> {
3232
/// Create a new `Tree` from any data sorted by offset, ascending as returned by the `data_sorted_by_offsets` iterator.
3333
/// * `get_pack_offset(item: &T) -> data::Offset` is a function returning the pack offset of the given item, which can be used
34-
/// for obtaining the objects entry within the pack.
34+
/// for obtaining the objects entry within the pack.
3535
/// * `pack_path` is the path to the pack file itself and from which to read the entry data, which is a pack file matching the offsets
36-
/// returned by `get_pack_offset(…)`.
36+
/// returned by `get_pack_offset(…)`.
3737
/// * `progress` is used to track progress when creating the tree.
3838
/// * `resolve_in_pack_id(gix_hash::oid) -> Option<data::Offset>` takes an object ID and tries to resolve it to an object within this pack if
39-
/// possible. Failing to do so aborts the operation, and this function is not expected to be called in usual packs. It's a theoretical
40-
/// possibility though as old packs might have referred to their objects using the 20 bytes hash, instead of their encoded offset from the base.
39+
/// possible. Failing to do so aborts the operation, and this function is not expected to be called in usual packs. It's a theoretical
40+
/// possibility though as old packs might have referred to their objects using the 20 bytes hash, instead of their encoded offset from the base.
4141
///
4242
/// Note that the sort order is ascending. The given pack file path must match the provided offsets.
4343
pub fn from_offsets_in_pack(

gix-pack/src/data/output/entry/iter_from_counts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub(crate) mod function {
4040
///
4141
/// * ~~currently there is no way to easily write the pack index, even though the state here is uniquely positioned to do
4242
/// so with minimal overhead (especially compared to `gix index-from-pack`)~~ Probably works now by chaining Iterators
43-
/// or keeping enough state to write a pack and then generate an index with recorded data.
43+
/// or keeping enough state to write a pack and then generate an index with recorded data.
4444
///
4545
pub fn iter_from_counts<Find>(
4646
mut counts: Vec<output::Count>,

0 commit comments

Comments
 (0)