diff --git a/gitoxide-core/src/repository/attributes/validate_baseline.rs b/gitoxide-core/src/repository/attributes/validate_baseline.rs index 77eeb258a49..686c668add6 100644 --- a/gitoxide-core/src/repository/attributes/validate_baseline.rs +++ b/gitoxide-core/src/repository/attributes/validate_baseline.rs @@ -305,13 +305,13 @@ pub(crate) mod function { } fn parse_exclude(line: &str) -> Option<(String, Baseline)> { - let (left, value) = line.split_at(line.find(|c| c == '\t')?); + let (left, value) = line.split_at(line.find('\t')?); let value = &value[1..]; let location = if left == "::" { None } else { - let mut tokens = left.split(|b| b == ':'); + let mut tokens = left.split(':'); let source = tokens.next()?; let line_number: usize = tokens.next()?.parse().ok()?; let pattern = tokens.next()?; @@ -363,8 +363,8 @@ pub(crate) mod function { "unspecified" => StateRef::Unspecified, _ => StateRef::from_bytes(info.as_bytes()), }; - path = path.trim_end_matches(|b| b == ':'); - let attr = attr.trim_end_matches(|b| b == ':'); + path = path.trim_end_matches(':'); + let attr = attr.trim_end_matches(':'); let assignment = gix::attrs::AssignmentRef { name: gix::attrs::NameRef::try_from(attr.as_bytes().as_bstr()).ok()?, state, diff --git a/gitoxide-core/src/repository/index/entries.rs b/gitoxide-core/src/repository/index/entries.rs index 4485bad5c3e..20a21e3a38b 100644 --- a/gitoxide-core/src/repository/index/entries.rs +++ b/gitoxide-core/src/repository/index/entries.rs @@ -319,7 +319,7 @@ pub(crate) mod function { #[cfg(feature = "serde")] fn to_json( - mut out: &mut impl std::io::Write, + out: &mut impl std::io::Write, index: &gix::index::File, entry: &gix::index::Entry, attrs: Option, @@ -338,7 +338,7 @@ pub(crate) mod function { } serde_json::to_writer( - &mut out, + &mut *out, &Entry { stat: &entry.stat, hex_id: entry.id.to_hex().to_string(), diff --git a/gix-config/src/file/section/mod.rs b/gix-config/src/file/section/mod.rs index f07a145e3d4..1dd4bd15ad3 100644 --- a/gix-config/src/file/section/mod.rs +++ b/gix-config/src/file/section/mod.rs @@ -75,7 +75,7 @@ impl<'a> Section<'a> { /// Stream ourselves to the given `out`, in order to reproduce this section mostly losslessly /// as it was parsed. pub fn write_to(&self, mut out: &mut dyn std::io::Write) -> std::io::Result<()> { - self.header.write_to(&mut out)?; + self.header.write_to(&mut *out)?; if self.body.0.is_empty() { return Ok(()); diff --git a/gix-config/src/file/write.rs b/gix-config/src/file/write.rs index 772054f9529..f08f5db57a4 100644 --- a/gix-config/src/file/write.rs +++ b/gix-config/src/file/write.rs @@ -18,7 +18,7 @@ impl File<'_> { pub fn write_to_filter( &self, mut out: &mut dyn std::io::Write, - mut filter: &mut dyn FnMut(&Section<'_>) -> bool, + filter: &mut dyn FnMut(&Section<'_>) -> bool, ) -> std::io::Result<()> { let nl = self.detect_newline_style(); @@ -27,7 +27,8 @@ impl File<'_> { event.write_to(&mut out)?; } - if !ends_with_newline(self.frontmatter_events.as_ref(), nl, true) && self.sections.values().any(&mut filter) + if !ends_with_newline(self.frontmatter_events.as_ref(), nl, true) + && self.sections.values().any(&mut *filter) { out.write_all(nl)?; } diff --git a/gix-config/src/parse/event.rs b/gix-config/src/parse/event.rs index d88ace7ce6c..653a0c67751 100644 --- a/gix-config/src/parse/event.rs +++ b/gix-config/src/parse/event.rs @@ -33,7 +33,7 @@ impl Event<'_> { /// Stream ourselves to the given `out`, in order to reproduce this event mostly losslessly /// as it was parsed. - pub fn write_to(&self, mut out: &mut dyn std::io::Write) -> std::io::Result<()> { + pub fn write_to(&self, out: &mut dyn std::io::Write) -> std::io::Result<()> { match self { Self::ValueNotDone(e) => { out.write_all(e.as_ref())?; @@ -42,8 +42,8 @@ impl Event<'_> { Self::Whitespace(e) | Self::Newline(e) | Self::Value(e) | Self::ValueDone(e) => out.write_all(e.as_ref()), Self::KeyValueSeparator => out.write_all(b"="), Self::SectionKey(k) => out.write_all(k.0.as_ref()), - Self::SectionHeader(h) => h.write_to(&mut out), - Self::Comment(c) => c.write_to(&mut out), + Self::SectionHeader(h) => h.write_to(out), + Self::Comment(c) => c.write_to(out), } } diff --git a/gix-config/src/parse/events.rs b/gix-config/src/parse/events.rs index 5e0c8f06bf1..feda7a7ca6c 100644 --- a/gix-config/src/parse/events.rs +++ b/gix-config/src/parse/events.rs @@ -28,26 +28,26 @@ pub type FrontMatterEvents<'a> = SmallVec<[Event<'a>; 8]>; /// /// For concrete examples, some notable differences are: /// - `git-config` sections permit subsections via either a quoted string -/// (`[some-section "subsection"]`) or via the deprecated dot notation -/// (`[some-section.subsection]`). Successful parsing these section names is not -/// well defined in typical `.ini` parsers. This parser will handle these cases -/// perfectly. +/// (`[some-section "subsection"]`) or via the deprecated dot notation +/// (`[some-section.subsection]`). Successful parsing these section names is not +/// well defined in typical `.ini` parsers. This parser will handle these cases +/// perfectly. /// - Comment markers are not strictly defined either. This parser will always -/// and only handle a semicolon or octothorpe (also known as a hash or number -/// sign). +/// and only handle a semicolon or octothorpe (also known as a hash or number +/// sign). /// - Global properties may be allowed in `.ini` parsers, but is strictly -/// disallowed by this parser. +/// disallowed by this parser. /// - Only `\t`, `\n`, `\b` `\\` are valid escape characters. /// - Quoted and semi-quoted values will be parsed (but quotes will be included -/// in event outputs). An example of a semi-quoted value is `5"hello world"`, -/// which should be interpreted as `5hello world` after -/// [normalization][crate::value::normalize()]. +/// in event outputs). An example of a semi-quoted value is `5"hello world"`, +/// which should be interpreted as `5hello world` after +/// [normalization][crate::value::normalize()]. /// - Line continuations via a `\` character is supported (inside or outside of quotes) /// - Whitespace handling similarly follows the `git-config` specification as -/// closely as possible, where excess whitespace after a non-quoted value are -/// trimmed, and line continuations onto a new line with excess spaces are kept. +/// closely as possible, where excess whitespace after a non-quoted value are +/// trimmed, and line continuations onto a new line with excess spaces are kept. /// - Only equal signs (optionally padded by spaces) are valid name/value -/// delimiters. +/// delimiters. /// /// Note that things such as case-sensitivity or duplicate sections are /// _not_ handled. This parser is a low level _syntactic_ interpreter @@ -62,8 +62,8 @@ pub type FrontMatterEvents<'a> = SmallVec<[Event<'a>; 8]>; /// # Trait Implementations /// /// - This struct does _not_ implement [`FromStr`] due to lifetime -/// constraints implied on the required `from_str` method. Instead, it provides -/// [`From<&'_ str>`]. +/// constraints implied on the required `from_str` method. Instead, it provides +/// [`From<&'_ str>`]. /// /// # Idioms /// diff --git a/gix-ignore/src/search.rs b/gix-ignore/src/search.rs index a527b447221..9b5a2766b61 100644 --- a/gix-ignore/src/search.rs +++ b/gix-ignore/src/search.rs @@ -55,7 +55,7 @@ impl Search { .transpose()?, ); group.patterns.extend(pattern::List::::from_file( - &git_dir.join("info").join("exclude"), + git_dir.join("info").join("exclude"), None, follow_symlinks, buf, diff --git a/gix-pack/src/bundle/write/mod.rs b/gix-pack/src/bundle/write/mod.rs index f91898e8640..88a56858b57 100644 --- a/gix-pack/src/bundle/write/mod.rs +++ b/gix-pack/src/bundle/write/mod.rs @@ -51,8 +51,8 @@ impl crate::Bundle { /// * `progress` provides detailed progress information which can be discarded with [`gix_features::progress::Discard`]. /// * `should_interrupt` is checked regularly and when true, the whole operation will stop. /// * `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 - /// expected to exist in the object database the bundle is contained within. - /// `options` further configure how the task is performed. + /// expected to exist in the object database the bundle is contained within. + /// `options` further configure how the task is performed. /// /// # Note /// diff --git a/gix-pack/src/cache/delta/from_offsets.rs b/gix-pack/src/cache/delta/from_offsets.rs index fc807264d77..4b05bed4e56 100644 --- a/gix-pack/src/cache/delta/from_offsets.rs +++ b/gix-pack/src/cache/delta/from_offsets.rs @@ -31,13 +31,13 @@ const PACK_HEADER_LEN: usize = 12; impl Tree { /// Create a new `Tree` from any data sorted by offset, ascending as returned by the `data_sorted_by_offsets` iterator. /// * `get_pack_offset(item: &T) -> data::Offset` is a function returning the pack offset of the given item, which can be used - /// for obtaining the objects entry within the pack. + /// for obtaining the objects entry within the pack. /// * `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 - /// returned by `get_pack_offset(…)`. + /// returned by `get_pack_offset(…)`. /// * `progress` is used to track progress when creating the tree. /// * `resolve_in_pack_id(gix_hash::oid) -> Option` takes an object ID and tries to resolve it to an object within this pack if - /// possible. Failing to do so aborts the operation, and this function is not expected to be called in usual packs. It's a theoretical - /// possibility though as old packs might have referred to their objects using the 20 bytes hash, instead of their encoded offset from the base. + /// possible. Failing to do so aborts the operation, and this function is not expected to be called in usual packs. It's a theoretical + /// possibility though as old packs might have referred to their objects using the 20 bytes hash, instead of their encoded offset from the base. /// /// Note that the sort order is ascending. The given pack file path must match the provided offsets. pub fn from_offsets_in_pack( diff --git a/gix-pack/src/data/output/entry/iter_from_counts.rs b/gix-pack/src/data/output/entry/iter_from_counts.rs index c65f29ced49..5760bbb22fe 100644 --- a/gix-pack/src/data/output/entry/iter_from_counts.rs +++ b/gix-pack/src/data/output/entry/iter_from_counts.rs @@ -40,7 +40,7 @@ pub(crate) mod function { /// /// * ~~currently there is no way to easily write the pack index, even though the state here is uniquely positioned to do /// so with minimal overhead (especially compared to `gix index-from-pack`)~~ Probably works now by chaining Iterators - /// or keeping enough state to write a pack and then generate an index with recorded data. + /// or keeping enough state to write a pack and then generate an index with recorded data. /// pub fn iter_from_counts( mut counts: Vec, diff --git a/gix-pack/src/index/write/mod.rs b/gix-pack/src/index/write/mod.rs index 2247d8a1ebe..ca3d8348088 100644 --- a/gix-pack/src/index/write/mod.rs +++ b/gix-pack/src/index/write/mod.rs @@ -78,9 +78,9 @@ impl crate::index::File { /// /// * neither in-pack nor out-of-pack Ref Deltas are supported here, these must have been resolved beforehand. /// * `make_resolver()` will only be called after the iterator stopped returning elements and produces a function that - /// provides all bytes belonging to a pack entry writing them to the given mutable output `Vec`. - /// It should return `None` if the entry cannot be resolved from the pack that produced the `entries` iterator, causing - /// the write operation to fail. + /// provides all bytes belonging to a pack entry writing them to the given mutable output `Vec`. + /// It should return `None` if the entry cannot be resolved from the pack that produced the `entries` iterator, causing + /// the write operation to fail. #[allow(clippy::too_many_arguments)] pub fn write_data_iter_to_stream( version: crate::index::Version, diff --git a/gix-status/src/index_as_worktree_with_renames/types.rs b/gix-status/src/index_as_worktree_with_renames/types.rs index 76e9287e6d2..84ba2e24ec5 100644 --- a/gix-status/src/index_as_worktree_with_renames/types.rs +++ b/gix-status/src/index_as_worktree_with_renames/types.rs @@ -325,10 +325,10 @@ pub struct Context<'a> { /// /// * `attr_stack` /// - A stack pre-configured to allow accessing attributes for each entry, as required for `filter` - /// and possibly pathspecs. - /// It *may* also allow accessing `.gitignore` information for use in the directory walk. - /// If no excludes information is present, the directory walk will identify ignored files as untracked, which - /// might be desirable under certain circumstances. + /// and possibly pathspecs. + /// It *may* also allow accessing `.gitignore` information for use in the directory walk. + /// If no excludes information is present, the directory walk will identify ignored files as untracked, which + /// might be desirable under certain circumstances. /// * `filter` /// - A filter to be able to perform conversions from and to the worktree format. /// It is needed to potentially refresh the index with data read from the worktree, which needs to be converted back diff --git a/src/porcelain/main.rs b/src/porcelain/main.rs index 9024c193775..95645d843d5 100644 --- a/src/porcelain/main.rs +++ b/src/porcelain/main.rs @@ -62,11 +62,11 @@ pub fn main() -> Result<()> { progress, progress_keep_open, crate::shared::STANDARD_RANGE, - move |mut progress, out, mut err| { + move |mut progress, out, err| { let engine = query::prepare( &repo_dir, &mut progress, - &mut err, + &mut *err, query::Options { object_cache_size_mb, find_copies_harder,