From 8e96ed37db680855d194c10673ba2dab28655d95 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Fri, 21 Feb 2025 09:40:55 +0100 Subject: [PATCH 1/4] thanks clippy --- Cargo.toml | 1 + gitoxide-core/src/hours/mod.rs | 2 +- gitoxide-core/src/index/information.rs | 8 ++-- gitoxide-core/src/lib.rs | 2 +- gitoxide-core/src/pack/explode.rs | 2 +- gitoxide-core/src/pack/index.rs | 2 +- gitoxide-core/src/pack/receive.rs | 2 +- gitoxide-core/src/pack/verify.rs | 4 +- gitoxide-core/src/query/engine/update.rs | 2 +- gitoxide-core/src/repository/clean.rs | 2 +- gitoxide-core/src/repository/clone.rs | 2 +- gitoxide-core/src/repository/config.rs | 2 +- gitoxide-core/src/repository/diff.rs | 2 +- gitoxide-core/src/repository/fetch.rs | 2 +- gitoxide-core/src/repository/index/entries.rs | 2 +- gitoxide-core/src/repository/remote.rs | 2 +- gitoxide-core/src/repository/submodule.rs | 2 +- gix-attributes/src/search/outcome.rs | 7 +--- gix-blame/src/file/function.rs | 2 +- gix-commitgraph/src/file/init.rs | 2 +- gix-config-value/src/path.rs | 4 +- gix-config/src/file/includes/mod.rs | 2 +- gix-config/src/file/init/from_paths.rs | 2 +- gix-config/src/file/section/body.rs | 2 +- gix-config/src/parse/events.rs | 2 +- .../tests/program/from_custom_definition.rs | 2 +- gix-date/src/parse.rs | 2 +- gix-diff/src/blob/pipeline.rs | 42 +++++++++---------- gix-diff/src/blob/platform.rs | 2 +- gix-diff/src/rewrites/tracker.rs | 10 ++--- gix-diff/src/tree/function.rs | 10 ++--- gix-diff/tests/diff/rewrites/tracker.rs | 4 +- gix-discover/src/repository.rs | 6 ++- gix-discover/tests/discover/upwards/mod.rs | 4 +- gix-features/src/io.rs | 4 +- gix-features/src/parallel/eager_iter.rs | 8 ++-- gix-features/src/parallel/mod.rs | 6 +-- gix-filter/src/driver/process/server.rs | 2 +- gix-filter/src/pipeline/convert.rs | 2 +- gix-fs/src/dir/create.rs | 4 +- gix-glob/src/parse.rs | 2 +- gix-glob/src/wildmatch.rs | 10 ++--- gix-glob/tests/pattern/matching.rs | 2 +- gix-hash/src/prefix.rs | 2 +- gix-index/src/access/mod.rs | 4 +- gix-index/src/entry/flags.rs | 2 +- gix-index/src/entry/mode.rs | 2 +- gix-index/src/write.rs | 2 +- gix-macros/src/momo.rs | 2 +- gix-mailmap/src/snapshot/mod.rs | 2 +- gix-merge/src/blob/pipeline.rs | 2 +- gix-merge/src/blob/platform/set_resource.rs | 2 +- gix-merge/src/tree/function.rs | 26 ++++++------ gix-merge/src/tree/mod.rs | 4 +- gix-merge/tests/merge/blob/builtin_driver.rs | 2 +- gix-merge/tests/merge/tree/mod.rs | 2 +- gix-object/benches/edit_tree.rs | 2 +- gix-object/src/tree/editor.rs | 2 +- gix-odb/src/alternate/mod.rs | 2 +- gix-odb/src/store_impls/dynamic/load_index.rs | 2 +- gix-odb/src/store_impls/dynamic/types.rs | 2 +- gix-odb/src/store_impls/loose/iter.rs | 2 +- gix-pack/src/bundle/write/mod.rs | 4 +- gix-pack/src/cache/delta/from_offsets.rs | 4 +- gix-pack/src/cache/delta/traverse/resolve.rs | 4 +- gix-pack/src/data/file/decode/entry.rs | 2 +- gix-pack/src/data/file/decode/header.rs | 2 +- gix-pack/src/data/input/entry.rs | 2 +- gix-pack/src/data/output/bytes.rs | 4 +- .../src/data/output/count/objects/tree.rs | 2 +- gix-pack/src/data/output/entry/mod.rs | 4 +- gix-pack/src/index/traverse/with_index.rs | 2 +- gix-pack/src/index/verify.rs | 2 +- gix-pack/src/index/write/mod.rs | 6 +-- .../src/read/sidebands/blocking_io.rs | 6 +-- .../src/read/sidebands/blocking_io.rs | 6 +-- gix-path/src/lib.rs | 4 +- gix-pathspec/src/parse.rs | 2 +- gix-pathspec/tests/parse/invalid.rs | 2 +- .../src/fetch/response/blocking_io.rs | 2 +- gix-protocol/src/fetch/response/mod.rs | 2 +- gix-protocol/src/handshake/refs/shared.rs | 2 +- gix-protocol/src/remote_progress.rs | 2 +- gix-ref/src/store/file/find.rs | 12 ++++-- gix-ref/src/store/file/log/iter.rs | 2 +- gix-ref/src/store/file/loose/reflog.rs | 2 +- .../loose/reflog/create_or_update/tests.rs | 2 +- gix-ref/src/store/file/raw_ext.rs | 2 +- gix-ref/src/store/file/transaction/commit.rs | 2 +- gix-ref/src/store/file/transaction/prepare.rs | 4 +- gix-ref/src/transaction/ext.rs | 2 +- .../create_or_update/mod.rs | 2 +- gix-refspec/src/match_group/util.rs | 2 +- gix-refspec/tests/refspec/matching.rs | 2 +- gix-revision/src/spec/parse/delegate.rs | 2 +- gix-revision/src/spec/parse/function.rs | 10 ++--- gix-revwalk/src/graph/mod.rs | 6 +-- gix-submodule/src/is_active_platform.rs | 2 +- .../client/blocking_io/http/curl/remote.rs | 4 +- .../src/client/blocking_io/http/traits.rs | 2 +- .../client/blocking_io/ssh/program_kind.rs | 2 +- gix-transport/src/client/non_io_types.rs | 2 +- .../tests/client/blocking_io/http/mod.rs | 4 +- gix-traverse/src/commit/simple.rs | 4 +- gix-traverse/src/commit/topo/iter.rs | 4 +- gix-traverse/src/tree/breadthfirst.rs | 8 ++-- gix-url/src/lib.rs | 2 +- gix-worktree-state/tests/state/checkout.rs | 4 +- gix-worktree/src/stack/state/mod.rs | 2 +- gix/src/clone/fetch/util.rs | 4 +- gix/src/config/cache/incubate.rs | 4 +- gix/src/config/snapshot/_impls.rs | 2 +- gix/src/config/snapshot/credential_helpers.rs | 8 ++-- gix/src/create.rs | 2 +- gix/src/object/blob.rs | 2 +- gix/src/remote/build.rs | 8 ++-- .../connection/fetch/update_refs/mod.rs | 4 +- gix/src/remote/connection/ref_map.rs | 2 +- gix/src/remote/init.rs | 16 ++++--- gix/src/remote/url/rewrite.rs | 2 +- gix/src/repository/config/branch.rs | 11 ++--- gix/src/repository/init.rs | 2 +- gix/src/revision/spec/parse/delegate/mod.rs | 38 ++++++++--------- .../revision/spec/parse/delegate/revision.rs | 2 +- gix/src/revision/walk.rs | 4 +- gix/src/status/iter/mod.rs | 2 +- gix/tests/gix/object/tree/diff.rs | 7 ++-- gix/tests/gix/repository/excludes.rs | 2 +- src/shared.rs | 2 +- tests/it/src/commands/check_mode.rs | 4 +- tests/tools/src/main.rs | 2 +- 131 files changed, 272 insertions(+), 268 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7a6c104465c..a4363e5d151 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -325,6 +325,7 @@ bin-dir = "gitoxide-max-pure-v{ version }-{ target }/{ bin }{ binary-ext }" pedantic = { level = "warn", priority = -1 } # # Reviewed and allowed lints +needless_continue = "allow" enum_glob_use = "allow" # x97 missing_errors_doc = "allow" # x1792 missing_panics_doc = "allow" # x447 diff --git a/gitoxide-core/src/hours/mod.rs b/gitoxide-core/src/hours/mod.rs index 5b527c5dc59..b233e013d46 100644 --- a/gitoxide-core/src/hours/mod.rs +++ b/gitoxide-core/src/hours/mod.rs @@ -180,7 +180,7 @@ where break; } Err(err) => return Err(err.into()), - }; + } } if let Some(tx) = tx_tree_id { tx.send(chunk).ok(); diff --git a/gitoxide-core/src/index/information.rs b/gitoxide-core/src/index/information.rs index 34d211093c8..d9fe591f505 100644 --- a/gitoxide-core/src/index/information.rs +++ b/gitoxide-core/src/index/information.rs @@ -92,16 +92,16 @@ mod serde_only { }); if f.link().is_some() { names.push("link"); - }; + } if f.resolve_undo().is_some() { names.push("resolve-undo (REUC)"); - }; + } if f.untracked().is_some() { names.push("untracked (UNTR)"); - }; + } if f.fs_monitor().is_some() { names.push("fs-monitor (FSMN)"); - }; + } if f.had_offset_table() { names.push("offset-table (IEOT)"); } diff --git a/gitoxide-core/src/lib.rs b/gitoxide-core/src/lib.rs index 3b0237d1e52..a33b76a349a 100644 --- a/gitoxide-core/src/lib.rs +++ b/gitoxide-core/src/lib.rs @@ -86,7 +86,7 @@ pub use discover::discover; pub fn env(mut out: impl std::io::Write, format: OutputFormat) -> anyhow::Result<()> { if format != OutputFormat::Human { bail!("JSON output isn't supported"); - }; + } let width = 15; writeln!( diff --git a/gitoxide-core/src/pack/explode.rs b/gitoxide-core/src/pack/explode.rs index 9e51cf51a17..0ae360d95b5 100644 --- a/gitoxide-core/src/pack/explode.rs +++ b/gitoxide-core/src/pack/explode.rs @@ -161,7 +161,7 @@ pub fn pack_or_pack_index( ) })?; - if !object_path.as_ref().map_or(true, |p| p.as_ref().is_dir()) { + if !object_path.as_ref().is_none_or(|p| p.as_ref().is_dir()) { return Err(anyhow!( "The object directory at '{}' is inaccessible", object_path diff --git a/gitoxide-core/src/pack/index.rs b/gitoxide-core/src/pack/index.rs index 7838f6337fa..cde1afacb17 100644 --- a/gitoxide-core/src/pack/index.rs +++ b/gitoxide-core/src/pack/index.rs @@ -114,7 +114,7 @@ pub fn from_pack( OutputFormat::Human => drop(human_output(out, res)), #[cfg(feature = "serde")] OutputFormat::Json => serde_json::to_writer_pretty(out, &res)?, - }; + } Ok(()) } diff --git a/gitoxide-core/src/pack/receive.rs b/gitoxide-core/src/pack/receive.rs index 426905da529..5c717ed12db 100644 --- a/gitoxide-core/src/pack/receive.rs +++ b/gitoxide-core/src/pack/receive.rs @@ -306,6 +306,6 @@ fn receive_pack_blocking( OutputFormat::Json => { serde_json::to_writer_pretty(&mut out, &JsonOutcome::from_outcome_and_refs(outcome, refs))?; } - }; + } Ok(()) } diff --git a/gitoxide-core/src/pack/verify.rs b/gitoxide-core/src/pack/verify.rs index 6c9eed25328..0e6a5d3bdfd 100644 --- a/gitoxide-core/src/pack/verify.rs +++ b/gitoxide-core/src/pack/verify.rs @@ -177,7 +177,7 @@ where #[cfg(feature = "serde")] Some(OutputFormat::Json) => serde_json::to_writer_pretty(out, &multi_index.index_names().iter().zip(res.pack_traverse_statistics).collect::>())?, _ => {} - }; + } return Ok(()) }, _ => return Err(anyhow!( @@ -195,7 +195,7 @@ where #[cfg(feature = "serde")] Some(OutputFormat::Json) => serde_json::to_writer_pretty(out, stats)?, _ => {} - }; + } } Ok(()) } diff --git a/gitoxide-core/src/query/engine/update.rs b/gitoxide-core/src/query/engine/update.rs index 84520f51c27..2515f9ab092 100644 --- a/gitoxide-core/src/query/engine/update.rs +++ b/gitoxide-core/src/query/engine/update.rs @@ -447,7 +447,7 @@ pub fn update( break; } Err(err) => return Err(err.into()), - }; + } } db.send_last_chunk(); let saw_new_commits = !commits.is_empty(); diff --git a/gitoxide-core/src/repository/clean.rs b/gitoxide-core/src/repository/clean.rs index 6d858182e72..bd5939d45c1 100644 --- a/gitoxide-core/src/repository/clean.rs +++ b/gitoxide-core/src/repository/clean.rs @@ -213,7 +213,7 @@ pub(crate) mod function { continue; } } - }; + } let is_ignored = matches!(entry.status, gix::dir::entry::Status::Ignored(_)); let entry_path = gix::path::from_bstr(entry.rela_path); diff --git a/gitoxide-core/src/repository/clone.rs b/gitoxide-core/src/repository/clone.rs index 88daf903e3e..c5cfa530784 100644 --- a/gitoxide-core/src/repository/clone.rs +++ b/gitoxide-core/src/repository/clone.rs @@ -114,7 +114,7 @@ pub(crate) mod function { &mut err, )?; } - }; + } if let Some(gix::worktree::state::checkout::Outcome { collisions, errors, .. }) = outcome { if !(collisions.is_empty() && errors.is_empty()) { diff --git a/gitoxide-core/src/repository/config.rs b/gitoxide-core/src/repository/config.rs index c39272a2ebe..821272a2072 100644 --- a/gitoxide-core/src/repository/config.rs +++ b/gitoxide-core/src/repository/config.rs @@ -84,7 +84,7 @@ impl Filter { } (None, _) => {} (Some(_), None) => return false, - }; + } true } } diff --git a/gitoxide-core/src/repository/diff.rs b/gitoxide-core/src/repository/diff.rs index 0927acbeec6..0f507ba8747 100644 --- a/gitoxide-core/src/repository/diff.rs +++ b/gitoxide-core/src/repository/diff.rs @@ -99,7 +99,7 @@ fn write_changes( writeln!(out, " {:o} -> {:o}", source_entry_mode.0, entry_mode.0)?; } } - }; + } } Ok(()) diff --git a/gitoxide-core/src/repository/fetch.rs b/gitoxide-core/src/repository/fetch.rs index e8d229765bc..7be5ef9d076 100644 --- a/gitoxide-core/src/repository/fetch.rs +++ b/gitoxide-core/src/repository/fetch.rs @@ -264,7 +264,7 @@ pub(crate) mod function { gix::remote::fetch::refmap::Source::Ref(r) => { crate::repository::remote::refs::print_ref(&mut out, r)?; } - }; + } let mode_and_type = update.type_change.map_or_else( || format!("{}", update.mode), |type_change| { diff --git a/gitoxide-core/src/repository/index/entries.rs b/gitoxide-core/src/repository/index/entries.rs index 74057464cf6..470fdd3bd0b 100644 --- a/gitoxide-core/src/repository/index/entries.rs +++ b/gitoxide-core/src/repository/index/entries.rs @@ -184,7 +184,7 @@ pub(crate) mod function { .unwrap_or_default() }, ) - .map_or(true, |m| m.is_excluded()); + .is_none_or(|m| m.is_excluded()); let entry_is_submodule = entry.mode.is_submodule(); if entry_is_excluded && (!entry_is_submodule || !recurse_submodules) { diff --git a/gitoxide-core/src/repository/remote.rs b/gitoxide-core/src/repository/remote.rs index eeb634566c2..7b6b4ff18bd 100644 --- a/gitoxide-core/src/repository/remote.rs +++ b/gitoxide-core/src/repository/remote.rs @@ -105,7 +105,7 @@ mod refs_impl { out, &map.remote_refs.into_iter().map(JsonRef::from).collect::>(), )?, - }; + } Ok(()) } } diff --git a/gitoxide-core/src/repository/submodule.rs b/gitoxide-core/src/repository/submodule.rs index 12ef64870e8..9938eb71a8e 100644 --- a/gitoxide-core/src/repository/submodule.rs +++ b/gitoxide-core/src/repository/submodule.rs @@ -28,7 +28,7 @@ fn print_sm(sm: Submodule<'_>, dirty_suffix: Option<&str>, out: &mut impl std::i let mut sm_repo = sm.open()?; if let Some(repo) = sm_repo.as_mut() { repo.object_cache_size_if_unset(4 * 1024 * 1024); - }; + } writeln!( out, " {is_active} {path} {config} head:{head_id} index:{index_id} ({worktree}) [{url}]", diff --git a/gix-attributes/src/search/outcome.rs b/gix-attributes/src/search/outcome.rs index bae1896e70f..2edc41655fe 100644 --- a/gix-attributes/src/search/outcome.rs +++ b/gix-attributes/src/search/outcome.rs @@ -237,12 +237,7 @@ impl Outcome { } fn reduce_and_check_if_done(&mut self, attr: AttributeId) -> bool { - if self.selected.is_empty() - || self - .selected - .iter() - .any(|(_name, id)| id.map_or(false, |id| id == attr)) - { + if self.selected.is_empty() || self.selected.iter().any(|(_name, id)| *id == Some(attr)) { *self.remaining.as_mut().expect("initialized") -= 1; } self.is_done() diff --git a/gix-blame/src/file/function.rs b/gix-blame/src/file/function.rs index 621da6f0d0f..576611896d6 100644 --- a/gix-blame/src/file/function.rs +++ b/gix-blame/src/file/function.rs @@ -684,7 +684,7 @@ fn collect_parents( parent_ids.push((id, parent_commit_time)); } } - }; + } Ok(parent_ids) } diff --git a/gix-commitgraph/src/file/init.rs b/gix-commitgraph/src/file/init.rs index c2468d73e01..022cc7b7ea2 100644 --- a/gix-commitgraph/src/file/init.rs +++ b/gix-commitgraph/src/file/init.rs @@ -85,7 +85,7 @@ impl File { x => { return Err(Error::UnsupportedVersion(x)); } - }; + } ofs += 1; let object_hash = gix_hash::Kind::try_from(data[ofs]).map_err(Error::UnsupportedHashVersion)?; diff --git a/gix-config-value/src/path.rs b/gix-config-value/src/path.rs index 4d5d08e017e..8646a19de79 100644 --- a/gix-config-value/src/path.rs +++ b/gix-config-value/src/path.rs @@ -122,8 +122,8 @@ impl<'a> Path<'a> { /// the `home_for_user` function to be provided. /// The interpolation uses `getpwnam` sys call and is therefore not available on windows. /// - `%(prefix)/` is expanded to the location where `gitoxide` is installed. - /// This location is not known at compile time and therefore need to be - /// optionally provided by the caller through `git_install_dir`. + /// This location is not known at compile time and therefore need to be + /// optionally provided by the caller through `git_install_dir`. /// /// Any other, non-empty path value is returned unchanged and error is returned in case of an empty path value or if required input /// wasn't provided. diff --git a/gix-config/src/file/includes/mod.rs b/gix-config/src/file/includes/mod.rs index 434042ea9ac..298a615de74 100644 --- a/gix-config/src/file/includes/mod.rs +++ b/gix-config/src/file/includes/mod.rs @@ -32,7 +32,7 @@ impl File<'static> { /// which later overwrite portions of the included file, which seems unusual as these would be related to `includes`. /// We can fix this by 'splitting' the include section if needed so the included sections are put into the right place. /// - `hasconfig:remote.*.url` will not prevent itself to include files with `[remote "name"]\nurl = x` values, but it also - /// won't match them, i.e. one cannot include something that will cause the condition to match or to always be true. + /// won't match them, i.e. one cannot include something that will cause the condition to match or to always be true. pub fn resolve_includes(&mut self, options: init::Options<'_>) -> Result<(), Error> { if options.includes.max_depth == 0 { return Ok(()); diff --git a/gix-config/src/file/init/from_paths.rs b/gix-config/src/file/init/from_paths.rs index c0412a95f70..6e574e0d9bd 100644 --- a/gix-config/src/file/init/from_paths.rs +++ b/gix-config/src/file/init/from_paths.rs @@ -116,7 +116,7 @@ impl File<'static> { return Err(Error::Io { source: err, path }); } } - }; + } meta.path = Some(path); let config = Self::from_bytes_owned(buf, meta, options)?; diff --git a/gix-config/src/file/section/body.rs b/gix-config/src/file/section/body.rs index 54f26303feb..97ad3e2e1ff 100644 --- a/gix-config/src/file/section/body.rs +++ b/gix-config/src/file/section/body.rs @@ -151,7 +151,7 @@ impl Body<'_> { value_range.end = i; } else { value_range.start = i; - }; + } } _ => (), } diff --git a/gix-config/src/parse/events.rs b/gix-config/src/parse/events.rs index 843c90a5956..2eb14d679d5 100644 --- a/gix-config/src/parse/events.rs +++ b/gix-config/src/parse/events.rs @@ -305,7 +305,7 @@ fn from_bytes<'a, 'b>( events: std::mem::take(&mut events), }); } - }; + } header = match convert(Event::SectionHeader(next_header)) { Event::SectionHeader(h) => h, _ => unreachable!("BUG: convert must not change the event type, just the lifetime"), diff --git a/gix-credentials/tests/program/from_custom_definition.rs b/gix-credentials/tests/program/from_custom_definition.rs index 4ef71f4ee4a..25e9dd2ae4b 100644 --- a/gix-credentials/tests/program/from_custom_definition.rs +++ b/gix-credentials/tests/program/from_custom_definition.rs @@ -12,7 +12,7 @@ const SH: &str = "/bin/sh"; fn empty() { let prog = Program::from_custom_definition(""); let git = *GIT; - assert!(matches!(&prog.kind, Kind::ExternalName { name_and_args } if name_and_args == "")); + assert!(matches!(&prog.kind, Kind::ExternalName { name_and_args } if name_and_args.is_empty())); assert_eq!( format!("{:?}", prog.to_command(&helper::Action::Store("egal".into()))), format!(r#""{git}" "credential-" "store""#), diff --git a/gix-date/src/parse.rs b/gix-date/src/parse.rs index 2a026e5eaa6..afd3470ac60 100644 --- a/gix-date/src/parse.rs +++ b/gix-date/src/parse.rs @@ -77,7 +77,7 @@ pub(crate) mod function { let mut offset_in_seconds = hours * 3600 + minutes * 60; if sign == Sign::Minus { offset_in_seconds *= -1; - }; + } let time = Time { seconds, offset: offset_in_seconds, diff --git a/gix-diff/src/blob/pipeline.rs b/gix-diff/src/blob/pipeline.rs index 6ad308e7223..a4a02d80f37 100644 --- a/gix-diff/src/blob/pipeline.rs +++ b/gix-diff/src/blob/pipeline.rs @@ -395,7 +395,7 @@ impl Pipeline { && header.size > self.options.large_file_threshold_bytes { is_binary = Some(true); - }; + } let data = if is_binary == Some(true) { Data::Binary { size: header.size } } else { @@ -461,27 +461,25 @@ impl Pipeline { out.clear(); run_cmd(rela_path, cmd, out)?; } - None => { - match res { - ToWorktreeOutcome::Unchanged(_) => {} - ToWorktreeOutcome::Buffer(src) => { - out.clear(); - out.try_reserve(src.len())?; - out.extend_from_slice(src); - } - ToWorktreeOutcome::Process(MaybeDelayed::Immediate(mut stream)) => { - std::io::copy(&mut stream, out).map_err(|err| { - convert_to_diffable::Error::StreamCopy { - rela_path: rela_path.to_owned(), - source: err, - } - })?; - } - ToWorktreeOutcome::Process(MaybeDelayed::Delayed(_)) => { - unreachable!("we prohibit this") - } - }; - } + None => match res { + ToWorktreeOutcome::Unchanged(_) => {} + ToWorktreeOutcome::Buffer(src) => { + out.clear(); + out.try_reserve(src.len())?; + out.extend_from_slice(src); + } + ToWorktreeOutcome::Process(MaybeDelayed::Immediate(mut stream)) => { + std::io::copy(&mut stream, out).map_err(|err| { + convert_to_diffable::Error::StreamCopy { + rela_path: rela_path.to_owned(), + source: err, + } + })?; + } + ToWorktreeOutcome::Process(MaybeDelayed::Delayed(_)) => { + unreachable!("we prohibit this") + } + }, } } diff --git a/gix-diff/src/blob/platform.rs b/gix-diff/src/blob/platform.rs index b64092c92e8..8e67897ddd4 100644 --- a/gix-diff/src/blob/platform.rs +++ b/gix-diff/src/blob/platform.rs @@ -362,7 +362,7 @@ impl Platform { /// * `mode` is the kind of object (only blobs and links are allowed) /// * `rela_path` is the relative path as seen from the (work)tree root. /// * `kind` identifies the side of the diff this resource will be used for. - /// A diff needs both `OldOrSource` *and* `NewOrDestination`. + /// A diff needs both `OldOrSource` *and* `NewOrDestination`. /// * `objects` provides access to the object database in case the resource can't be read from a worktree. /// /// Note that it's assumed that either `id + mode (` or `rela_path` can serve as unique identifier for the resource, diff --git a/gix-diff/src/rewrites/tracker.rs b/gix-diff/src/rewrites/tracker.rs index fa135388f53..267fbd450b4 100644 --- a/gix-diff/src/rewrites/tracker.rs +++ b/gix-diff/src/rewrites/tracker.rs @@ -166,9 +166,9 @@ impl Tracker { /// We may refuse the push if that information isn't needed for what we have to track. pub fn try_push_change(&mut self, change: T, location: &BStr) -> Option { let change_kind = change.kind(); - if let (None, ChangeKind::Modification { .. }) = (self.rewrites.copies, change_kind) { + if let (None, ChangeKind::Modification) = (self.rewrites.copies, change_kind) { return Some(change); - }; + } let entry_kind = change.entry_mode().kind(); if entry_kind == EntryKind::Commit { @@ -179,7 +179,7 @@ impl Tracker { .filter(|_| matches!(change_kind, ChangeKind::Addition | ChangeKind::Deletion)); if let (None, EntryKind::Tree) = (relation, entry_kind) { return Some(change); - }; + } let start = self.path_backing.len(); self.path_backing.extend_from_slice(location); @@ -514,7 +514,7 @@ impl Tracker { dst_items.push((item.change.id().to_owned(), item)); } _ => continue, - }; + } } for ((src_id, src_item), (dst_id, dst_item)) in src_items.into_iter().zip(dst_items) { @@ -758,7 +758,7 @@ fn find_match<'a, T: Change>( Operation::SourceOrDestinationIsBinary => { // TODO: figure out if git does more here } - }; + } } } Ok(None) diff --git a/gix-diff/src/tree/function.rs b/gix-diff/src/tree/function.rs index 8dfc4dfb079..634cb07aa49 100644 --- a/gix-diff/src/tree/function.rs +++ b/gix-diff/src/tree/function.rs @@ -70,7 +70,7 @@ where } Some((None, None, _)) => unreachable!("BUG: it makes no sense to fill the stack with empties"), None => return Ok(()), - }; + } pop_path = false; } (Some(lhs), Some(rhs)) => { @@ -328,7 +328,7 @@ fn handle_lhs_and_rhs_with_equal_filenames( .cancelled() { return Err(Error::Cancelled); - }; + } let relation = relation_to_propagate.or_else(|| { *change_id += 1; @@ -343,7 +343,7 @@ fn handle_lhs_and_rhs_with_equal_filenames( .cancelled() { return Err(Error::Cancelled); - }; + } queue.push_back((None, Some(rhs.oid.to_owned()), to_child(relation))); } (true, _) => { @@ -371,7 +371,7 @@ fn handle_lhs_and_rhs_with_equal_filenames( .cancelled() { return Err(Error::Cancelled); - }; + } queue.push_back((Some(lhs.oid.to_owned()), None, to_child(relation))); } (false, false) => { @@ -390,7 +390,7 @@ fn handle_lhs_and_rhs_with_equal_filenames( return Err(Error::Cancelled); } } - }; + } Ok(()) } diff --git a/gix-diff/tests/diff/rewrites/tracker.rs b/gix-diff/tests/diff/rewrites/tracker.rs index 22101b4208a..e010a9c81f8 100644 --- a/gix-diff/tests/diff/rewrites/tracker.rs +++ b/gix-diff/tests/diff/rewrites/tracker.rs @@ -441,7 +441,7 @@ fn rename_by_similarity_reports_limit_if_encountered() -> crate::Result { 1 => assert_eq!(dst.location, "b"), 2 => assert_eq!(dst.location, "c"), _ => panic!("too many elements emitted"), - }; + } calls += 1; Action::Continue }, @@ -511,7 +511,7 @@ fn rename_by_50_percent_similarity() -> crate::Result { assert_eq!(dst.location, "c"); } _ => panic!("too many elements emitted"), - }; + } calls += 1; Action::Continue }, diff --git a/gix-discover/src/repository.rs b/gix-discover/src/repository.rs index 92fc633f354..52d099c46b4 100644 --- a/gix-discover/src/repository.rs +++ b/gix-discover/src/repository.rs @@ -76,7 +76,11 @@ mod path { None => { let mut dir = normalize_on_trailing_dot_dot(dir)?; dir.pop(); // ".git" suffix - let work_dir = dir.as_os_str().is_empty().then(|| PathBuf::from(".")).unwrap_or(dir); + let work_dir = if dir.as_os_str().is_empty() { + PathBuf::from(".") + } else { + dir + }; Path::WorkTree(work_dir) } }, diff --git a/gix-discover/tests/discover/upwards/mod.rs b/gix-discover/tests/discover/upwards/mod.rs index c1e575deae4..9d75e047d3b 100644 --- a/gix-discover/tests/discover/upwards/mod.rs +++ b/gix-discover/tests/discover/upwards/mod.rs @@ -319,7 +319,7 @@ fn do_not_shorten_absolute_paths() -> crate::Result { assert!(work_dir.is_absolute()); } _ => panic!("expected worktree path"), - }; + } Ok(()) } @@ -345,7 +345,7 @@ mod dot_git_only { assert_eq!(work_dir, expected.as_ref()); } _ => panic!("expected worktree path"), - }; + } } #[test] diff --git a/gix-features/src/io.rs b/gix-features/src/io.rs index fba2736939a..4521e3af925 100644 --- a/gix-features/src/io.rs +++ b/gix-features/src/io.rs @@ -30,7 +30,7 @@ pub mod pipe { Ok(Err(err)) => return Err(err), Err(_) => {} } - }; + } Ok(&self.buf) } @@ -77,7 +77,7 @@ pub mod pipe { /// Returns the _([`write`][Writer], [`read`][Reader])_ ends of a pipe for transferring bytes, analogous to a unix pipe. /// /// * `in_flight_writes` defines the amount of chunks of bytes to keep in memory until the `write` end will block when writing. - /// If `0`, the `write` end will always block until the `read` end consumes the transferred bytes. + /// If `0`, the `write` end will always block until the `read` end consumes the transferred bytes. pub fn unidirectional(in_flight_writes: usize) -> (Writer, Reader) { let (tx, rx) = std::sync::mpsc::sync_channel(in_flight_writes); ( diff --git a/gix-features/src/parallel/eager_iter.rs b/gix-features/src/parallel/eager_iter.rs index 9a1735f72a4..64f51ca3a59 100644 --- a/gix-features/src/parallel/eager_iter.rs +++ b/gix-features/src/parallel/eager_iter.rs @@ -17,11 +17,11 @@ where /// with a given `chunk_size` allowing a maximum `chunks_in_flight`. /// /// * `chunk_size` describes how many items returned by `iter` will be a single item of this `EagerIter`. - /// This helps to reduce the overhead imposed by transferring many small items. - /// If this number is 1, each item will become a single chunk. 0 is invalid. + /// This helps to reduce the overhead imposed by transferring many small items. + /// If this number is 1, each item will become a single chunk. 0 is invalid. /// * `chunks_in_flight` describes how many chunks can be kept in memory in case the consumer of the `EagerIter`s items - /// isn't consuming them fast enough. Setting this number to 0 effectively turns off any caching, but blocks `EagerIter` - /// if its items aren't consumed fast enough. + /// isn't consuming them fast enough. Setting this number to 0 effectively turns off any caching, but blocks `EagerIter` + /// if its items aren't consumed fast enough. pub fn new(iter: I, chunk_size: usize, chunks_in_flight: usize) -> Self { let (sender, receiver) = std::sync::mpsc::sync_channel(chunks_in_flight); let size_hint = iter.size_hint(); diff --git a/gix-features/src/parallel/mod.rs b/gix-features/src/parallel/mod.rs index 5a0a4b5890d..8e676d786a9 100644 --- a/gix-features/src/parallel/mod.rs +++ b/gix-features/src/parallel/mod.rs @@ -66,11 +66,11 @@ pub fn optimize_chunk_size_and_thread_limit( /// /// * `desired_chunk_size` is the amount of items per chunk you think should be used. /// * `num_items` is the total amount of items in the iteration, if `Some`. -/// Otherwise this knowledge will not affect the output of this function. +/// Otherwise this knowledge will not affect the output of this function. /// * `thread_limit` is the amount of threads to use at most, if `Some`. -/// Otherwise this knowledge will not affect the output of this function. +/// Otherwise this knowledge will not affect the output of this function. /// * `available_threads` is the total amount of threads available, if `Some`. -/// Otherwise the actual amount of available threads is determined by querying the system. +/// Otherwise the actual amount of available threads is determined by querying the system. /// /// `Note` that this implementation is available only if the `parallel` feature toggle is set. #[cfg(feature = "parallel")] diff --git a/gix-filter/src/driver/process/server.rs b/gix-filter/src/driver/process/server.rs index 929080e0b49..8afdebc3b63 100644 --- a/gix-filter/src/driver/process/server.rs +++ b/gix-filter/src/driver/process/server.rs @@ -126,7 +126,7 @@ impl Server { } } None => continue, - }; + } } for cap in &capabilities { diff --git a/gix-filter/src/pipeline/convert.rs b/gix-filter/src/pipeline/convert.rs index 37c0071a6d2..4253e91ec5c 100644 --- a/gix-filter/src/pipeline/convert.rs +++ b/gix-filter/src/pipeline/convert.rs @@ -202,7 +202,7 @@ impl Pipeline { let (src, dest) = bufs.src_and_dest(); if eol::convert_to_worktree(src, digest, dest, self.options.eol_config)? { bufs.swap(); - }; + } if let Some(encoding) = encoding { let (src, dest) = bufs.src_and_dest(); diff --git a/gix-fs/src/dir/create.rs b/gix-fs/src/dir/create.rs index 93dd5badbef..bca6b982b5b 100644 --- a/gix-fs/src/dir/create.rs +++ b/gix-fs/src/dir/create.rs @@ -165,7 +165,7 @@ impl<'a> Iterator for Iter<'a> { } if self.retries.on_create_directory_failure < 1 { return self.permanent_failure(dir, NotFound); - }; + } self.cursors.push(dir); self.cursors.push(match dir.parent() { None => return self.permanent_failure(dir, InvalidInput), @@ -177,7 +177,7 @@ impl<'a> Iterator for Iter<'a> { self.retries.on_interrupt -= 1; if self.retries.on_interrupt <= 1 { return self.permanent_failure(dir, Interrupted); - }; + } self.cursors.push(dir); self.intermediate_failure(dir, err) } diff --git a/gix-glob/src/parse.rs b/gix-glob/src/parse.rs index 368cf77c565..2777a9a1030 100644 --- a/gix-glob/src/parse.rs +++ b/gix-glob/src/parse.rs @@ -13,7 +13,7 @@ pub fn pattern(mut pat: &[u8], may_alter: bool) -> Option<(&[u8], pattern::Mode, let mut mode = Mode::empty(); if pat.is_empty() { return None; - }; + } if may_alter { if pat.first() == Some(&b'!') { mode |= Mode::NEGATIVE; diff --git a/gix-glob/src/wildmatch.rs b/gix-glob/src/wildmatch.rs index 964736f50b1..6bb16cf7110 100644 --- a/gix-glob/src/wildmatch.rs +++ b/gix-glob/src/wildmatch.rs @@ -157,7 +157,7 @@ pub(crate) mod function { t_ch = t.1; } None => break, - }; + } } if t_ch != p_ch { return NoMatch; @@ -177,7 +177,7 @@ pub(crate) mod function { t_ch = t.1; } None => break AbortAll, - }; + } }; } BRACKET_OPEN => { @@ -187,7 +187,7 @@ pub(crate) mod function { p_ch = t.1; } None => return AbortAll, - }; + } if p_ch == b'^' { p_ch = NEGATE_CLASS; @@ -326,7 +326,7 @@ pub(crate) mod function { } } _ => return AbortAll, - }; + } prev_p_ch = 0; } } @@ -336,7 +336,7 @@ pub(crate) mod function { matched = true; } } - }; + } next = p.next(); if let Some((_, BRACKET_CLOSE)) = next { break; diff --git a/gix-glob/tests/pattern/matching.rs b/gix-glob/tests/pattern/matching.rs index 1c042b4246f..6c119f343c8 100644 --- a/gix-glob/tests/pattern/matching.rs +++ b/gix-glob/tests/pattern/matching.rs @@ -88,7 +88,7 @@ fn compare_baseline_with_ours() { panics += 1; continue; } - }; + } } } diff --git a/gix-hash/src/prefix.rs b/gix-hash/src/prefix.rs index 1871a96240a..5da49c03000 100644 --- a/gix-hash/src/prefix.rs +++ b/gix-hash/src/prefix.rs @@ -100,7 +100,7 @@ impl Prefix { return Err(from_hex::Error::TooLong { hex_len }); } else if hex_len < Self::MIN_HEX_LEN { return Err(from_hex::Error::TooShort { hex_len }); - }; + } let src = if value.len() % 2 == 0 { let mut out = Vec::from_iter(std::iter::repeat(0).take(value.len() / 2)); diff --git a/gix-index/src/access/mod.rs b/gix-index/src/access/mod.rs index 8cf9cd57610..eaccb836db9 100644 --- a/gix-index/src/access/mod.rs +++ b/gix-index/src/access/mod.rs @@ -194,7 +194,7 @@ impl State { let entry_path = e.path(self); if entry_path == path { return true; - }; + } if !ignore_case { return false; } @@ -222,7 +222,7 @@ impl State { let dir_path = dir.path(self); if dir_path == directory { return true; - }; + } if !ignore_case { return false; } diff --git a/gix-index/src/entry/flags.rs b/gix-index/src/entry/flags.rs index dacd311b3ed..1a770350df9 100644 --- a/gix-index/src/entry/flags.rs +++ b/gix-index/src/entry/flags.rs @@ -12,7 +12,7 @@ bitflags! { /// The mask to obtain the length of the path associated with this entry, up to 4095 characters without extension. const PATH_LEN = 0x0fff; /// The mask to apply to obtain the stage number of an entry, encoding three value: 0 = base, 1 = ours, 2 = theirs. - const STAGE_MASK = 1<<12 | 1<<13; + const STAGE_MASK = (1<<12) | (1<<13); /// If set, additional bits need to be written to storage. const EXTENDED = 1<<14; /// If set, the entry be assumed to match with the version on the working tree, as a way to avoid `lstat()` checks. diff --git a/gix-index/src/entry/mode.rs b/gix-index/src/entry/mode.rs index 63e08decd92..ec839d5335e 100644 --- a/gix-index/src/entry/mode.rs +++ b/gix-index/src/entry/mode.rs @@ -55,7 +55,7 @@ impl Mode { Mode::FILE if executable_bit && stat.is_executable() => return Some(Change::ExecutableBit), Mode::FILE_EXECUTABLE if executable_bit && !stat.is_executable() => return Some(Change::ExecutableBit), _ => return None, - }; + } let new_mode = if stat.is_dir() { Mode::COMMIT } else if executable_bit && stat.is_executable() { diff --git a/gix-index/src/write.rs b/gix-index/src/write.rs index 034ef4b58cf..e0b9554c220 100644 --- a/gix-index/src/write.rs +++ b/gix-index/src/write.rs @@ -176,7 +176,7 @@ fn entries(out: &mut CountBytes, state: &State, header_siz let eight_null_bytes = [0u8; 8]; out.write_all(&eight_null_bytes[n as usize..])?; } - }; + } } Ok(out.count) diff --git a/gix-macros/src/momo.rs b/gix-macros/src/momo.rs index 74b1636d30c..a007c1b2082 100644 --- a/gix-macros/src/momo.rs +++ b/gix-macros/src/momo.rs @@ -126,7 +126,7 @@ fn parse_bounds(bounds: &Punctuated) -> Option { self.entries_by_old_email.insert(insert_pos, entry.into()); } - }; + } } self } diff --git a/gix-merge/src/blob/pipeline.rs b/gix-merge/src/blob/pipeline.rs index 776d908e203..82a6610748b 100644 --- a/gix-merge/src/blob/pipeline.rs +++ b/gix-merge/src/blob/pipeline.rs @@ -293,7 +293,7 @@ impl Pipeline { ToWorktreeOutcome::Process(MaybeDelayed::Delayed(_)) => { unreachable!("we prohibit this") } - }; + } } let res = self.filter.convert_to_git( diff --git a/gix-merge/src/blob/platform/set_resource.rs b/gix-merge/src/blob/platform/set_resource.rs index 75be7b65e07..49f8248914b 100644 --- a/gix-merge/src/blob/platform/set_resource.rs +++ b/gix-merge/src/blob/platform/set_resource.rs @@ -97,7 +97,7 @@ impl Platform { storage.data = out; storage.mode = mode; } - }; + } Ok(()) } } diff --git a/gix-merge/src/tree/function.rs b/gix-merge/src/tree/function.rs index a1d1719f112..029974c363a 100644 --- a/gix-merge/src/tree/function.rs +++ b/gix-merge/src/tree/function.rs @@ -22,7 +22,7 @@ use std::convert::Infallible; /// * `labels` are relevant for text-merges and will be shown in conflicts. /// * `objects` provides access to trees when diffing them. /// * `write_blob_to_odb(content) -> Result` writes newly merged content into the odb to obtain an id -/// that will be used in merged trees. +/// that will be used in merged trees. /// * `diff_state` is state used for diffing trees. /// * `diff_resource_cache` is used for similarity checks. /// * `blob_merge` is a pre-configured platform to merge any content. @@ -208,7 +208,7 @@ where [None, None, None], )) { break 'outer; - }; + } editor.remove(to_components(theirs.location()))?; } apply_change(&mut editor, theirs, rewritten_location.as_ref().map(|t| &t.0))?; @@ -274,7 +274,7 @@ where } if should_fail_on_conflict(conflict) { break 'outer; - }; + } } else if matches!(candidate, PossibleConflict::TreeToNonTree { .. }) { let (mode, id) = theirs.entry_mode_and_id(); let location = theirs.location(); @@ -316,7 +316,7 @@ where their_changes[theirs_idx].was_written = true; if should_fail_on_conflict(conflict) { break 'outer; - }; + } } else if matches!(candidate, PossibleConflict::NonTreeToTree { .. }) { // We are writing on top of what was a file, a conflict we probably already saw and dealt with. let location = theirs.location(); @@ -543,7 +543,7 @@ where ], )) { break 'outer; - }; + } } ( Change::Addition { @@ -795,10 +795,10 @@ where editor.remove(toc(location))?; } _ => unreachable!("parent-match assures this"), - }; + } } Some(ResolveWith::Ancestor) => {} - }; + } should_fail_on_conflict(Conflict::without_resolution( ResolutionFailure::OursModifiedTheirsDeleted, (ours, theirs, side, outer_side), @@ -807,7 +807,7 @@ where }; if should_break { break 'outer; - }; + } } ( Change::Modification { .. }, @@ -921,7 +921,7 @@ where ], )) { break 'outer; - }; + } match tree_conflicts { None => { let our_addition = Change::Addition { @@ -983,7 +983,7 @@ where ], )) { break 'outer; - }; + } } if let Some(addition) = our_addition { push_deferred((addition, Some(ours_idx)), our_changes); @@ -1054,7 +1054,7 @@ where ], )) { break 'outer; - }; + } let ours_is_rewrite = side.is_swapped(); if tree_conflicts.is_none() @@ -1139,7 +1139,7 @@ where [None, index_entry(our_mode, our_id), index_entry(their_mode, their_id)], )) { break 'outer; - }; + } } // Because this constellation can only be found by the lookup tree, there is @@ -1236,7 +1236,7 @@ where } if should_fail_on_conflict(Conflict::unknown((ours, theirs, Original, outer_side))) { break 'outer; - }; + } } } their_changes[theirs_idx].was_written = true; diff --git a/gix-merge/src/tree/mod.rs b/gix-merge/src/tree/mod.rs index b01a14eb378..cd82a2d2910 100644 --- a/gix-merge/src/tree/mod.rs +++ b/gix-merge/src/tree/mod.rs @@ -581,7 +581,7 @@ pub mod apply_index_entries { index.entry_index_by_path_and_stage_bounded(path, gix_index::entry::Stage::Unconflicted, len) { index.entries_mut()[pos].flags.insert(gix_index::entry::Flags::REMOVE); - }; + } match idx_by_path_stage.entry((stage, path)) { hash_map::Entry::Occupied(map_entry) => { // This can happen due to the way the algorithm works. @@ -604,7 +604,7 @@ pub mod apply_index_entries { path, ); } - }; + } } } diff --git a/gix-merge/tests/merge/blob/builtin_driver.rs b/gix-merge/tests/merge/blob/builtin_driver.rs index f34fb190205..21b29bdcbbb 100644 --- a/gix-merge/tests/merge/blob/builtin_driver.rs +++ b/gix-merge/tests/merge/blob/builtin_driver.rs @@ -171,7 +171,7 @@ mod text { "{}: resolution mismatch", case.name ); - }; + } assert_str_eq!( out.as_bstr().to_str_lossy(), case.expected.to_str_lossy(), diff --git a/gix-merge/tests/merge/tree/mod.rs b/gix-merge/tests/merge/tree/mod.rs index f417fc08e85..dfe0971ed3c 100644 --- a/gix-merge/tests/merge/tree/mod.rs +++ b/gix-merge/tests/merge/tree/mod.rs @@ -151,7 +151,7 @@ fn run_baseline() -> crate::Result { if !tree_path.exists() { skipped_tree_resolve_cases += 1; continue; - }; + } let expected_tree_id = gix_hash::ObjectId::from_hex(std::fs::read_to_string(tree_path)?.trim().as_bytes())?; options.tree_merge.tree_conflicts = Some(tree_resolution); let resolve_with_ours = tree_resolution == gix_merge::tree::ResolveWith::Ours; diff --git a/gix-object/benches/edit_tree.rs b/gix-object/benches/edit_tree.rs index ba063d89a08..41f1e5f9839 100644 --- a/gix-object/benches/edit_tree.rs +++ b/gix-object/benches/edit_tree.rs @@ -155,7 +155,7 @@ fn new_inmemory_writes() -> (TreeStore, impl FnMut(&Tree) -> Result { e.insert(tree.clone()); } - }; + } Ok(id) } }; diff --git a/gix-object/src/tree/editor.rs b/gix-object/src/tree/editor.rs index b4371b541b5..3e4e9fa7a19 100644 --- a/gix-object/src/tree/editor.rs +++ b/gix-object/src/tree/editor.rs @@ -153,7 +153,7 @@ impl Editor<'_> { } } Err(_) => break, - }; + } } None } diff --git a/gix-odb/src/alternate/mod.rs b/gix-odb/src/alternate/mod.rs index c4e9fc8c040..0df9a0e4113 100644 --- a/gix-odb/src/alternate/mod.rs +++ b/gix-odb/src/alternate/mod.rs @@ -61,7 +61,7 @@ pub fn resolve(objects_directory: PathBuf, current_dir: &std::path::Path) -> Res } Err(err) if err.kind() == io::ErrorKind::NotFound => {} Err(err) => return Err(err.into()), - }; + } if depth != 0 { out.push(dir); } diff --git a/gix-odb/src/store_impls/dynamic/load_index.rs b/gix-odb/src/store_impls/dynamic/load_index.rs index 72594f8f552..1cd09d12e0c 100644 --- a/gix-odb/src/store_impls/dynamic/load_index.rs +++ b/gix-odb/src/store_impls/dynamic/load_index.rs @@ -418,7 +418,7 @@ impl super::Store { // Safety: can't race as we hold the lock, have to set the generation beforehand to help avoid others to observe the value. slot.generation.store(generation, Ordering::SeqCst); *files_mut = None; - }; + } slot.files.store(files); } diff --git a/gix-odb/src/store_impls/dynamic/types.rs b/gix-odb/src/store_impls/dynamic/types.rs index ef135ad6500..ff91761b5a8 100644 --- a/gix-odb/src/store_impls/dynamic/types.rs +++ b/gix-odb/src/store_impls/dynamic/types.rs @@ -61,7 +61,7 @@ impl PackId { midx <= Self::max_packs_in_multi_index(), "There shouldn't be more than 2^16 packs per multi-index" ); - ((self.index as gix_pack::data::Id | 1 << 15) | midx << 16) as gix_pack::data::Id + (self.index as gix_pack::data::Id | (1 << 15)) | (midx << 16) as gix_pack::data::Id } } } diff --git a/gix-odb/src/store_impls/loose/iter.rs b/gix-odb/src/store_impls/loose/iter.rs index d7723150f47..bb12623affa 100644 --- a/gix-odb/src/store_impls/loose/iter.rs +++ b/gix-odb/src/store_impls/loose/iter.rs @@ -34,7 +34,7 @@ impl loose::Iter { } } Err(err) => return Some(Err(err)), - }; + } None } } diff --git a/gix-pack/src/bundle/write/mod.rs b/gix-pack/src/bundle/write/mod.rs index ad759f5eed1..a50c3a83287 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 4b05bed4e56..c9c968d2287 100644 --- a/gix-pack/src/cache/delta/from_offsets.rs +++ b/gix-pack/src/cache/delta/from_offsets.rs @@ -86,7 +86,7 @@ impl Tree { let pack_offset = get_pack_offset(&data); if let Some(previous_offset) = previous_cursor_position { Self::advance_cursor_to_pack_offset(&mut r, pack_offset, previous_offset)?; - }; + } let entry = crate::data::Entry::from_read(&mut r, pack_offset, hash_len).map_err(|err| Error::Io { source: err, message: "EOF while parsing header", @@ -111,7 +111,7 @@ impl Tree { .expect("in bound distance for deltas"); tree.add_child(base_pack_offset, pack_offset, data)?; } - }; + } progress.inc(); if idx % 10_000 == 0 && should_interrupt.load(Ordering::SeqCst) { return Err(Error::Interrupted); diff --git a/gix-pack/src/cache/delta/traverse/resolve.rs b/gix-pack/src/cache/delta/traverse/resolve.rs index 56d7432e776..407baa1e782 100644 --- a/gix-pack/src/cache/delta/traverse/resolve.rs +++ b/gix-pack/src/cache/delta/traverse/resolve.rs @@ -251,8 +251,8 @@ where } /// * `initial_threads` is the threads we may spawn, not accounting for our own thread which is still considered used by the parent -/// system. Since this thread will take a controlling function, we may spawn one more than that. In threaded mode, we will finish -/// all remaining work. +/// system. Since this thread will take a controlling function, we may spawn one more than that. In threaded mode, we will finish +/// all remaining work. #[allow(clippy::too_many_arguments)] fn deltas_mt( mut threads_to_create: isize, diff --git a/gix-pack/src/data/file/decode/entry.rs b/gix-pack/src/data/file/decode/entry.rs index a3248b30ab5..eb09f456b1f 100644 --- a/gix-pack/src/data/file/decode/entry.rs +++ b/gix-pack/src/data/file/decode/entry.rs @@ -260,7 +260,7 @@ impl File { &first_entry, consumed_input.expect("consumed bytes as set by cache"), )); - }; + } // First pass will decompress all delta data and keep it in our output buffer // []... diff --git a/gix-pack/src/data/file/decode/header.rs b/gix-pack/src/data/file/decode/header.rs index e769a3657e1..1eb2e7b2f64 100644 --- a/gix-pack/src/data/file/decode/header.rs +++ b/gix-pack/src/data/file/decode/header.rs @@ -88,7 +88,7 @@ impl File { None => return Err(Error::DeltaBaseUnresolved(base_id)), } } - }; + } } } diff --git a/gix-pack/src/data/input/entry.rs b/gix-pack/src/data/input/entry.rs index 3230d1a808f..d36b1ec7539 100644 --- a/gix-pack/src/data/input/entry.rs +++ b/gix-pack/src/data/input/entry.rs @@ -59,7 +59,7 @@ fn compress_data(obj: &gix_object::Data<'_>) -> Result, input::Error> { unreachable!("Should never see other errors than zlib, but got {:?}", err,) } } - }; + } out.flush().expect("zlib flush should never fail"); Ok(out.into_inner()) } diff --git a/gix-pack/src/data/output/bytes.rs b/gix-pack/src/data/output/bytes.rs index 19f651c403d..849da6af6cf 100644 --- a/gix-pack/src/data/output/bytes.rs +++ b/gix-pack/src/data/output/bytes.rs @@ -107,7 +107,7 @@ where if entry.is_invalid() { self.pack_offsets_and_validity.push((0, false)); continue; - }; + } self.pack_offsets_and_validity.push((self.written, true)); let header = entry.to_entry_header(self.entry_version, |index| { let (base_offset, is_valid_object) = self.pack_offsets_and_validity[index]; @@ -128,7 +128,7 @@ where self.is_done = true; self.trailer = Some(gix_hash::ObjectId::from(digest)); } - }; + } Ok(self.written - previous_written) } } diff --git a/gix-pack/src/data/output/count/objects/tree.rs b/gix-pack/src/data/output/count/objects/tree.rs index 1187fa15baf..13648306b20 100644 --- a/gix-pack/src/data/output/count/objects/tree.rs +++ b/gix-pack/src/data/output/count/objects/tree.rs @@ -57,7 +57,7 @@ pub mod changes { } } Change::Deletion { .. } => {} - }; + } Action::Continue } } diff --git a/gix-pack/src/data/output/entry/mod.rs b/gix-pack/src/data/output/entry/mod.rs index 77a5da25141..32cdcb91e5f 100644 --- a/gix-pack/src/data/output/entry/mod.rs +++ b/gix-pack/src/data/output/entry/mod.rs @@ -72,7 +72,7 @@ impl output::Entry { ) -> Option> { if entry.version != target_version { return None; - }; + } let pack_offset_must_be_zero = 0; let pack_entry = match data::Entry::from_bytes(&entry.data, pack_offset_must_be_zero, count.id.as_slice().len()) @@ -144,7 +144,7 @@ impl output::Entry { std::io::ErrorKind::Other => return Err(Error::ZlibDeflate(err)), err => unreachable!("Should never see other errors than zlib, but got {:?}", err,), } - }; + } out.flush()?; out.into_inner() }, diff --git a/gix-pack/src/index/traverse/with_index.rs b/gix-pack/src/index/traverse/with_index.rs index c132fed3f21..b3c0f672b08 100644 --- a/gix-pack/src/index/traverse/with_index.rs +++ b/gix-pack/src/index/traverse/with_index.rs @@ -220,7 +220,7 @@ fn digest_statistics(traverse::Outcome { roots, children }: traverse::Outcome res.num_trees += 1, Tag => res.num_tags += 1, Commit => res.num_commits += 1, - }; + } } let num_nodes = roots.len() + children.len(); diff --git a/gix-pack/src/index/verify.rs b/gix-pack/src/index/verify.rs index 0ee4259a8fc..c2c72f0faa5 100644 --- a/gix-pack/src/index/verify.rs +++ b/gix-pack/src/index/verify.rs @@ -262,7 +262,7 @@ impl index::File { } } Blob => {} - }; + } } Ok(()) } diff --git a/gix-pack/src/index/write/mod.rs b/gix-pack/src/index/write/mod.rs index 4f07d0380c3..0f07bf7a932 100644 --- a/gix-pack/src/index/write/mod.rs +++ b/gix-pack/src/index/write/mod.rs @@ -69,10 +69,10 @@ impl crate::index::File { /// * `kind` is the version of pack index to produce, use [`crate::index::Version::default()`] if in doubt. /// * `tread_limit` is used for a parallel tree traversal for obtaining object hashes with optimal performance. /// * `root_progress` is the top-level progress to stay informed about the progress of this potentially long-running - /// computation. + /// computation. /// * `object_hash` defines what kind of object hash we write into the index file. /// * `pack_version` is the version of the underlying pack for which `entries` are read. It's used in case none of these objects are provided - /// to compute a pack-hash. + /// to compute a pack-hash. /// /// # Remarks /// @@ -164,7 +164,7 @@ impl crate::index::File { }, )?; } - }; + } last_seen_trailer = trailer; num_objects += 1; objects_progress.inc(); diff --git a/gix-packetline-blocking/src/read/sidebands/blocking_io.rs b/gix-packetline-blocking/src/read/sidebands/blocking_io.rs index 347993e57db..9b09baed10d 100644 --- a/gix-packetline-blocking/src/read/sidebands/blocking_io.rs +++ b/gix-packetline-blocking/src/read/sidebands/blocking_io.rs @@ -164,7 +164,7 @@ where "interrupted by user", )) } - }; + } } BandRef::Error(d) => { let text = TextRef::from(d).0; @@ -176,9 +176,9 @@ where "interrupted by user", )) } - }; + } } - }; + } } None => { break match line.as_slice() { diff --git a/gix-packetline/src/read/sidebands/blocking_io.rs b/gix-packetline/src/read/sidebands/blocking_io.rs index ac7dfbd982d..0e6cf00a793 100644 --- a/gix-packetline/src/read/sidebands/blocking_io.rs +++ b/gix-packetline/src/read/sidebands/blocking_io.rs @@ -162,7 +162,7 @@ where "interrupted by user", )) } - }; + } } BandRef::Error(d) => { let text = TextRef::from(d).0; @@ -174,9 +174,9 @@ where "interrupted by user", )) } - }; + } } - }; + } } None => { break match line.as_slice() { diff --git a/gix-path/src/lib.rs b/gix-path/src/lib.rs index da32d8df2e8..a83b8bde7a8 100644 --- a/gix-path/src/lib.rs +++ b/gix-path/src/lib.rs @@ -12,8 +12,8 @@ //! - mingw [is used for the conversion](https://github.com/git/git/blob/main/compat/mingw.h#L579:L579) and it appears they handle surrogates during the conversion, maybe some sort of non-strict UTF-8 converter? Actually it uses [WideCharToMultiByte](https://docs.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-widechartomultibyte) //! under the hood which by now does fail if the UTF-8 would be invalid unicode, i.e. unicode pairs. //! - `OsString` on windows already stores strings as WTF-8, which supports [surrogate pairs](https://unicodebook.readthedocs.io/unicode_encodings.html), -//! something that UTF-8 isn't allowed do it for security reasons, after all it's UTF-16 specific and exists only to extend -//! the encodable code-points. +//! something that UTF-8 isn't allowed do it for security reasons, after all it's UTF-16 specific and exists only to extend +//! the encodable code-points. //! - informative reading on [WTF-8](https://simonsapin.github.io/wtf-8/#motivation) which is the encoding used by Rust //! internally that deals with surrogates and non-wellformed surrogates (those that aren't in pairs). //! * **unix** diff --git a/gix-pathspec/src/parse.rs b/gix-pathspec/src/parse.rs index 9a21511caa0..bc7569ed76c 100644 --- a/gix-pathspec/src/parse.rs +++ b/gix-pathspec/src/parse.rs @@ -155,7 +155,7 @@ fn parse_long_keywords(input: &[u8], p: &mut Pattern, cursor: &mut usize) -> Res keyword: BString::from(keyword), }); } - }; + } Ok(()) }) } diff --git a/gix-pathspec/tests/parse/invalid.rs b/gix-pathspec/tests/parse/invalid.rs index d080f4afcff..2d446ad1468 100644 --- a/gix-pathspec/tests/parse/invalid.rs +++ b/gix-pathspec/tests/parse/invalid.rs @@ -137,7 +137,7 @@ fn missing_parentheses() { let output = gix_pathspec::parse(input.as_bytes(), Default::default()); assert!(output.is_err()); - assert!(matches!(output.unwrap_err(), Error::MissingClosingParenthesis { .. })); + assert!(matches!(output.unwrap_err(), Error::MissingClosingParenthesis)); } #[test] diff --git a/gix-protocol/src/fetch/response/blocking_io.rs b/gix-protocol/src/fetch/response/blocking_io.rs index b06bd3a1fd3..5d3c2f88e67 100644 --- a/gix-protocol/src/fetch/response/blocking_io.rs +++ b/gix-protocol/src/fetch/response/blocking_io.rs @@ -120,7 +120,7 @@ impl Response { io::ErrorKind::UnexpectedEof, "Could not read message headline", ))); - }; + } match line.trim_end() { "acknowledgments" => { diff --git a/gix-protocol/src/fetch/response/mod.rs b/gix-protocol/src/fetch/response/mod.rs index 941f3fcd9c1..f5b328b8bad 100644 --- a/gix-protocol/src/fetch/response/mod.rs +++ b/gix-protocol/src/fetch/response/mod.rs @@ -224,7 +224,7 @@ impl Response { } Err(_) => return true, }, - }; + } false } } diff --git a/gix-protocol/src/handshake/refs/shared.rs b/gix-protocol/src/handshake/refs/shared.rs index e321b25dbd8..a2848c64fc5 100644 --- a/gix-protocol/src/handshake/refs/shared.rs +++ b/gix-protocol/src/handshake/refs/shared.rs @@ -188,7 +188,7 @@ pub(in crate::handshake::refs) fn parse_v1( object, path: path.into(), }), - }; + } } } Ok(()) diff --git a/gix-protocol/src/remote_progress.rs b/gix-protocol/src/remote_progress.rs index 3dd6ce6d3bb..ab27f7d2799 100644 --- a/gix-protocol/src/remote_progress.rs +++ b/gix-protocol/src/remote_progress.rs @@ -66,7 +66,7 @@ impl RemoteProgress<'_> { } } None => progress.set_name(progress_name(progress.name(), text)), - }; + } } } } diff --git a/gix-ref/src/store/file/find.rs b/gix-ref/src/store/file/find.rs index 9d543b2b678..536810403d1 100644 --- a/gix-ref/src/store/file/find.rs +++ b/gix-ref/src/store/file/find.rs @@ -188,7 +188,7 @@ impl file::Store { res.strip_namespace(namespace); } return Ok(Some(res)); - }; + } } } Ok(None) @@ -225,9 +225,13 @@ impl file::Store { use crate::Category::*; let sn = FullNameRef::new_unchecked(sn); match c { - LinkedPseudoRef { name: worktree_name } => is_reflog - .then(|| (linked_git_dir(worktree_name).into(), sn)) - .unwrap_or((commondir.into(), name)), + LinkedPseudoRef { name: worktree_name } => { + if is_reflog { + (linked_git_dir(worktree_name).into(), sn) + } else { + (commondir.into(), name) + } + } Tag | LocalBranch | RemoteBranch | Note => (commondir.into(), name), MainRef | MainPseudoRef => (commondir.into(), sn), LinkedRef { name: worktree_name } => sn diff --git a/gix-ref/src/store/file/log/iter.rs b/gix-ref/src/store/file/log/iter.rs index 3c5e7bcb259..313d4df8c60 100644 --- a/gix-ref/src/store/file/log/iter.rs +++ b/gix-ref/src/store/file/log/iter.rs @@ -180,7 +180,7 @@ where let buf = &mut self.buf[..n]; if let Err(err) = read.read_exact(buf) { return Some(Err(err.into())); - }; + } let last_byte = *buf.last().expect("we have read non-zero bytes before"); self.last_nl_pos = Some(if last_byte != b'\n' { buf.len() } else { buf.len() - 1 }); diff --git a/gix-ref/src/store/file/loose/reflog.rs b/gix-ref/src/store/file/loose/reflog.rs index 208b44b4c2f..28ce1277872 100644 --- a/gix-ref/src/store/file/loose/reflog.rs +++ b/gix-ref/src/store/file/loose/reflog.rs @@ -126,7 +126,7 @@ pub mod create_or_update { } })?; options.create(true); - }; + } let file_for_appending = match options.open(&log_path) { Ok(f) => Some(f), diff --git a/gix-ref/src/store/file/loose/reflog/create_or_update/tests.rs b/gix-ref/src/store/file/loose/reflog/create_or_update/tests.rs index 45d74cead09..1e3de83175f 100644 --- a/gix-ref/src/store/file/loose/reflog/create_or_update/tests.rs +++ b/gix-ref/src/store/file/loose/reflog/create_or_update/tests.rs @@ -112,7 +112,7 @@ fn missing_reflog_creates_it_even_if_similarly_named_empty_dir_exists_and_append "there is no logs in disabled mode" ); } - }; + } // create onto existing directory let full_name_str = "refs/heads/other"; diff --git a/gix-ref/src/store/file/raw_ext.rs b/gix-ref/src/store/file/raw_ext.rs index c933df64911..ab6d1735784 100644 --- a/gix-ref/src/store/file/raw_ext.rs +++ b/gix-ref/src/store/file/raw_ext.rs @@ -124,7 +124,7 @@ impl ReferenceExt for Reference { })?; } _ => break oid, - }; + } }; self.peeled = Some(peeled_id); self.target = Target::Object(peeled_id); diff --git a/gix-ref/src/store/file/transaction/commit.rs b/gix-ref/src/store/file/transaction/commit.rs index c9247dc4bcc..fddfa8138f0 100644 --- a/gix-ref/src/store/file/transaction/commit.rs +++ b/gix-ref/src/store/file/transaction/commit.rs @@ -110,7 +110,7 @@ impl Transaction<'_, '_> { full_name: change.name(), }); } - }; + } } } Change::Delete { .. } => {} diff --git a/gix-ref/src/store/file/transaction/prepare.rs b/gix-ref/src/store/file/transaction/prepare.rs index caa7fcfa360..9ed6ab4d108 100644 --- a/gix-ref/src/store/file/transaction/prepare.rs +++ b/gix-ref/src/store/file/transaction/prepare.rs @@ -159,7 +159,7 @@ impl Transaction<'_, '_> { let full_name = change.name(); return Err(Error::MustExist { full_name, expected }); } - }; + } fn new_would_change_existing(new: &Target, existing: &Target) -> (bool, bool) { match (new, existing) { @@ -386,7 +386,7 @@ impl Transaction<'_, '_> { other => other, }; return Err(err); - }; + } // traverse parent chain from leaf/peeled ref and set the leaf previous oid accordingly // to help with their reflog entries diff --git a/gix-ref/src/transaction/ext.rs b/gix-ref/src/transaction/ext.rs index cd0c864013b..5e46387d444 100644 --- a/gix-ref/src/transaction/ext.rs +++ b/gix-ref/src/transaction/ext.rs @@ -66,7 +66,7 @@ where let edit = edit.borrow_mut(); if !edit.deref { continue; - }; + } // we can't tell what happened and we are here because it's a non-existing ref or an invalid one. // In any case, we don't want the following algorithms to try dereffing it and assume they deal with diff --git a/gix-ref/tests/refs/file/transaction/prepare_and_commit/create_or_update/mod.rs b/gix-ref/tests/refs/file/transaction/prepare_and_commit/create_or_update/mod.rs index f90d8cf03c4..26a9ae93308 100644 --- a/gix-ref/tests/refs/file/transaction/prepare_and_commit/create_or_update/mod.rs +++ b/gix-ref/tests/refs/file/transaction/prepare_and_commit/create_or_update/mod.rs @@ -96,7 +96,7 @@ fn reference_with_equally_named_empty_or_non_empty_directory_already_in_place_ca assert_eq!(source.to_string(), "Directory not empty"); } _ => unreachable!("other errors shouldn't happen here"), - }; + } } } Ok(()) diff --git a/gix-refspec/src/match_group/util.rs b/gix-refspec/src/match_group/util.rs index a5cae7fd59d..c4012717e57 100644 --- a/gix-refspec/src/match_group/util.rs +++ b/gix-refspec/src/match_group/util.rs @@ -94,7 +94,7 @@ impl<'a> Needle<'a> { } None => return Match::None, _ => {} - }; + } let tail = &name[*asterisk_pos + 1..]; if !item.full_ref_name.ends_with(tail) { return Match::None; diff --git a/gix-refspec/tests/refspec/matching.rs b/gix-refspec/tests/refspec/matching.rs index 42161942bbb..9fedf92d986 100644 --- a/gix-refspec/tests/refspec/matching.rs +++ b/gix-refspec/tests/refspec/matching.rs @@ -264,7 +264,7 @@ pub mod baseline { lhs = "HEAD".as_bytes(); } else { tokens.next(); - }; + } let rhs = tokens.next().unwrap().trim(); let local = (rhs != b"FETCH_HEAD").then(|| full_tracking_ref(rhs.into())); if !(lhs.as_bstr() == "HEAD" && local.is_none()) { diff --git a/gix-revision/src/spec/parse/delegate.rs b/gix-revision/src/spec/parse/delegate.rs index 1833b15bf96..3ff9039e991 100644 --- a/gix-revision/src/spec/parse/delegate.rs +++ b/gix-revision/src/spec/parse/delegate.rs @@ -73,7 +73,7 @@ pub trait Navigate { /// /// * `stage` ranges from 0 to 2, with 0 being the base, 1 being ours, 2 being theirs. /// * `path` without prefix is relative to the root of the repository, while prefixes like `./` and `../` make it - /// relative to the current working directory. + /// relative to the current working directory. fn index_lookup(&mut self, path: &BStr, stage: u8) -> Option<()>; } diff --git a/gix-revision/src/spec/parse/function.rs b/gix-revision/src/spec/parse/function.rs index 3297510b90a..9941c993499 100644 --- a/gix-revision/src/spec/parse/function.rs +++ b/gix-revision/src/spec/parse/function.rs @@ -201,7 +201,7 @@ fn long_describe_prefix(name: &BStr) -> Option<(&BStr, delegate::PrefixHint<'_>) let candidate = iter.by_ref().find_map(|substr| { if substr.first()? != &b'g' { return None; - }; + } let rest = substr.get(1..)?; rest.iter().all(u8::is_ascii_hexdigit).then(|| rest.as_bstr()) })?; @@ -213,7 +213,7 @@ fn long_describe_prefix(name: &BStr) -> Option<(&BStr, delegate::PrefixHint<'_>) .and_then(|generation| { iter.next().map(|token| { let last_token_len = token.len(); - let first_token_ptr = iter.last().map_or(token.as_ptr(), <[_]>::as_ptr); + let first_token_ptr = iter.next_back().map_or(token.as_ptr(), <[_]>::as_ptr); // SAFETY: both pointers are definitely part of the same object #[allow(unsafe_code)] let prior_tokens_len: usize = unsafe { token.as_ptr().offset_from(first_token_ptr) } @@ -274,7 +274,7 @@ fn parens(input: &[u8]) -> Result>, Error> { _ => { if ignore_next { skip_list.pop(); - }; + } ignore_next = false; } } @@ -307,7 +307,7 @@ fn try_parse(input: &BStr) -> Result n.parse().ok().map(|n| { if n == T::default() && input[0] == b'-' { return Err(Error::NegativeZero { input: input.into() }); - }; + } Ok(n) }) }) @@ -337,7 +337,7 @@ where [b':', b'2', b':', path @ ..] => return consume_all(delegate.index_lookup(path.as_bstr(), 2)), [b':', path @ ..] => return consume_all(delegate.index_lookup(path.as_bstr(), 0)), _ => {} - }; + } let mut sep_pos = None; let mut consecutive_hex_chars = Some(0); diff --git a/gix-revwalk/src/graph/mod.rs b/gix-revwalk/src/graph/mod.rs index 4fc1bdd77d4..8f064e0c2a9 100644 --- a/gix-revwalk/src/graph/mod.rs +++ b/gix-revwalk/src/graph/mod.rs @@ -252,7 +252,7 @@ impl Graph<'_, '_, Commit> { gix_hashtable::hash_map::Entry::Occupied(mut entry) => { update_data(&mut entry.get_mut().data); } - }; + } Ok(self.map.get_mut(&id)) } @@ -303,7 +303,7 @@ impl Graph<'_, '_, Commit> { gix_hashtable::hash_map::Entry::Occupied(mut entry) => { update_commit(entry.get_mut()); } - }; + } Ok(self.map.get_mut(&id)) } } @@ -337,7 +337,7 @@ impl<'cache, T> Graph<'_, 'cache, T> { gix_hashtable::hash_map::Entry::Occupied(mut entry) => { update_data(entry.get_mut()); } - }; + } commit })) } diff --git a/gix-submodule/src/is_active_platform.rs b/gix-submodule/src/is_active_platform.rs index b5b597acc45..b7fa5a26690 100644 --- a/gix-submodule/src/is_active_platform.rs +++ b/gix-submodule/src/is_active_platform.rs @@ -36,7 +36,7 @@ impl IsActivePlatform { ) -> Result { if let Some(val) = config.boolean(format!("submodule.{name}.active")).transpose()? { return Ok(val); - }; + } if let Some(val) = self.search.as_mut().map(|search| { search .pattern_matching_relative_path(name, Some(true), attributes) diff --git a/gix-transport/src/client/blocking_io/http/curl/remote.rs b/gix-transport/src/client/blocking_io/http/curl/remote.rs index de2302a31e4..c2f7755dfe6 100644 --- a/gix-transport/src/client/blocking_io/http/curl/remote.rs +++ b/gix-transport/src/client/blocking_io/http/curl/remote.rs @@ -102,7 +102,7 @@ impl curl::easy::Handler for Handler { .ok(); } } - }; + } true } } @@ -338,7 +338,7 @@ pub fn new() -> ( body.channel.try_send(err).ok(); } (None, None) => {} - }; + } } else { let handler = handle.get_mut(); if let Some((action, authenticate)) = proxy_auth_action { diff --git a/gix-transport/src/client/blocking_io/http/traits.rs b/gix-transport/src/client/blocking_io/http/traits.rs index d90a6dc2d49..b390eecc45a 100644 --- a/gix-transport/src/client/blocking_io/http/traits.rs +++ b/gix-transport/src/client/blocking_io/http/traits.rs @@ -23,7 +23,7 @@ impl crate::IsSpuriousError for Error { #[cfg(feature = "http-client-curl")] if let Some(err) = source.downcast_ref::() { return err.is_spurious(); - }; + } #[cfg(feature = "http-client-reqwest")] if let Some(err) = source.downcast_ref::() { return err.is_spurious(); diff --git a/gix-transport/src/client/blocking_io/ssh/program_kind.rs b/gix-transport/src/client/blocking_io/ssh/program_kind.rs index a9a5898a127..0bffb85f4e1 100644 --- a/gix-transport/src/client/blocking_io/ssh/program_kind.rs +++ b/gix-transport/src/client/blocking_io/ssh/program_kind.rs @@ -61,7 +61,7 @@ impl ProgramKind { }); } } - }; + } let host_maybe_with_user_as_ssh_arg = match (url.user_as_argument(), url.host_as_argument()) { (Usable(user), Usable(host)) => format!("{user}@{host}"), diff --git a/gix-transport/src/client/non_io_types.rs b/gix-transport/src/client/non_io_types.rs index 24a69a57e21..fa2599c0e22 100644 --- a/gix-transport/src/client/non_io_types.rs +++ b/gix-transport/src/client/non_io_types.rs @@ -76,7 +76,7 @@ pub(crate) mod connect { #[cfg(feature = "blocking-client")] if let Some(err) = err.downcast_ref::() { return err.is_spurious(); - }; + } if let Some(err) = err.downcast_ref::() { return err.is_spurious(); } diff --git a/gix-transport/tests/client/blocking_io/http/mod.rs b/gix-transport/tests/client/blocking_io/http/mod.rs index 42ec9010eb5..e47cf980e4b 100644 --- a/gix-transport/tests/client/blocking_io/http/mod.rs +++ b/gix-transport/tests/client/blocking_io/http/mod.rs @@ -130,7 +130,7 @@ fn http_will_use_pipelining() { Ok(_) => unreachable!("expecting permission denied to be detected"), Err(gix_transport::client::Error::Io(err)) if err.kind() == std::io::ErrorKind::PermissionDenied => {} Err(err) => unreachable!("{err:?}"), - }; + } client .set_identity(gix_sec::identity::Account { username: "foo".into(), @@ -141,7 +141,7 @@ fn http_will_use_pipelining() { Ok(_) => unreachable!("expecting permission denied to be detected"), Err(gix_transport::client::Error::Io(err)) if err.kind() == std::io::ErrorKind::PermissionDenied => {} Err(err) => unreachable!("{err:?}"), - }; + } thread.join().unwrap(); } diff --git a/gix-traverse/src/commit/simple.rs b/gix-traverse/src/commit/simple.rs index 03127ec4954..79de7f0d376 100644 --- a/gix-traverse/src/commit/simple.rs +++ b/gix-traverse/src/commit/simple.rs @@ -203,8 +203,8 @@ mod init { /// Create a new instance. /// /// * `find` - a way to lookup new object data during traversal by their `ObjectId`, writing their data into buffer and returning - /// an iterator over commit tokens if the object is present and is a commit. Caching should be implemented within this function - /// as needed. + /// an iterator over commit tokens if the object is present and is a commit. Caching should be implemented within this function + /// as needed. /// * `tips` /// * the starting points of the iteration, usually commits /// * each commit they lead to will only be returned once, including the tip that started it diff --git a/gix-traverse/src/commit/topo/iter.rs b/gix-traverse/src/commit/topo/iter.rs index 58963161076..547fa4e4359 100644 --- a/gix-traverse/src/commit/topo/iter.rs +++ b/gix-traverse/src/commit/topo/iter.rs @@ -208,7 +208,7 @@ where *i = 0; if let Err(e) = self.expand_topo_walk(&commit.id) { return Some(Err(e)); - }; + } Some(Ok(commit)) } @@ -289,7 +289,7 @@ where } } } - }; + } Ok(parents) } diff --git a/gix-traverse/src/tree/breadthfirst.rs b/gix-traverse/src/tree/breadthfirst.rs index 5a0342c337d..5d22287268e 100644 --- a/gix-traverse/src/tree/breadthfirst.rs +++ b/gix-traverse/src/tree/breadthfirst.rs @@ -46,10 +46,10 @@ pub(super) mod function { /// * `state` - all state used for the iteration. If multiple iterations are performed, allocations can be minimized by reusing /// this state. /// * `find` - a way to lookup new object data during traversal by their `ObjectId`, writing their data into buffer and returning - /// an iterator over entries if the object is present and is a tree. Caching should be implemented within this function - /// as needed. The return value is `Option` which degenerates all error information. Not finding a commit should also - /// be considered an errors as all objects in the tree DAG should be present in the database. Hence [`Error::Find`] should - /// be escalated into a more specific error if it's encountered by the caller. + /// an iterator over entries if the object is present and is a tree. Caching should be implemented within this function + /// as needed. The return value is `Option` which degenerates all error information. Not finding a commit should also + /// be considered an errors as all objects in the tree DAG should be present in the database. Hence [`Error::Find`] should + /// be escalated into a more specific error if it's encountered by the caller. /// * `delegate` - A way to observe entries and control the iteration while allowing the optimizer to let you pay only for what you use. pub fn breadthfirst( root: TreeRefIter<'_>, diff --git a/gix-url/src/lib.rs b/gix-url/src/lib.rs index 67ab8388731..44d2b348296 100644 --- a/gix-url/src/lib.rs +++ b/gix-url/src/lib.rs @@ -335,7 +335,7 @@ impl Url { } (None, None) => {} (Some(_user), None) => unreachable!("BUG: should not be possible to have a user but no host"), - }; + } if let Some(port) = &self.port { write!(&mut out, ":{port}")?; } diff --git a/gix-worktree-state/tests/state/checkout.rs b/gix-worktree-state/tests/state/checkout.rs index f69a5d748f1..f7fa8f2bb99 100644 --- a/gix-worktree-state/tests/state/checkout.rs +++ b/gix-worktree-state/tests/state/checkout.rs @@ -100,7 +100,7 @@ fn accidental_writes_through_symlinks_are_prevented_if_overwriting_is_forbidden( assert_eq!(stripped_prefix(&source_tree, &source_files), paths(expected)); assert_eq!(stripped_prefix(&destination, &worktree_files), paths(expected)); assert!(outcome.collisions.is_empty()); - }; + } } #[test] @@ -134,7 +134,7 @@ fn writes_through_symlinks_are_prevented_even_if_overwriting_is_allowed() { assert_eq!(stripped_prefix(&source_tree, &source_files), paths(expected)); assert_eq!(stripped_prefix(&destination, &worktree_files), paths(expected)); assert!(outcome.collisions.is_empty()); - }; + } } #[test] diff --git a/gix-worktree/src/stack/state/mod.rs b/gix-worktree/src/stack/state/mod.rs index 56e858dfcc2..be423623562 100644 --- a/gix-worktree/src/stack/state/mod.rs +++ b/gix-worktree/src/stack/state/mod.rs @@ -153,7 +153,7 @@ impl State { return None; } } - }; + } } Some((path.to_owned(), entry.id)) } else { diff --git a/gix/src/clone/fetch/util.rs b/gix/src/clone/fetch/util.rs index 780af0f5218..5ca6f6c6385 100644 --- a/gix/src/clone/fetch/util.rs +++ b/gix/src/clone/fetch/util.rs @@ -134,7 +134,7 @@ pub fn update_head( name: referent.clone(), deref: false, }); - }; + } edits }, gix_lock::acquire::Fail::Immediately, @@ -179,7 +179,7 @@ pub fn update_head( deref: false, })?; } - }; + } Ok(()) } diff --git a/gix/src/config/cache/incubate.rs b/gix/src/config/cache/incubate.rs index 7b4dc6d41b8..30b1904515f 100644 --- a/gix/src/config/cache/incubate.rs +++ b/gix/src/config/cache/incubate.rs @@ -72,7 +72,7 @@ impl StageOne { lenient, )?; config.append(worktree_config); - }; + } let precompose_unicode = config .boolean(&Core::PRECOMPOSE_UNICODE) .map(|v| Core::PRECOMPOSE_UNICODE.enrich_error(v)) @@ -144,7 +144,7 @@ fn load_config( } else { return Err(err); } - }; + } let config = gix_config::File::from_bytes_owned( buf, diff --git a/gix/src/config/snapshot/_impls.rs b/gix/src/config/snapshot/_impls.rs index ec22cb640b8..19b48aa39b1 100644 --- a/gix/src/config/snapshot/_impls.rs +++ b/gix/src/config/snapshot/_impls.rs @@ -27,7 +27,7 @@ impl Drop for SnapshotMut<'_> { fn drop(&mut self) { if let Some(repo) = self.repo.take() { self.commit_inner(repo).ok(); - }; + } } } diff --git a/gix/src/config/snapshot/credential_helpers.rs b/gix/src/config/snapshot/credential_helpers.rs index 434f37f6e70..7680ccf69a8 100644 --- a/gix/src/config/snapshot/credential_helpers.rs +++ b/gix/src/config/snapshot/credential_helpers.rs @@ -113,9 +113,11 @@ pub(super) mod function { let is_http = matches!(pattern.scheme, gix_url::Scheme::Https | gix_url::Scheme::Http); let scheme = &pattern.scheme; let host = pattern.host(); - let ports = is_http - .then(|| (pattern.port_or_default(), url.port_or_default())) - .unwrap_or((pattern.port, url.port)); + let ports = if is_http { + (pattern.port_or_default(), url.port_or_default()) + } else { + (pattern.port, url.port) + }; let path = (!(is_http && pattern.path_is_root())).then_some(&pattern.path); if !path.map_or(true, |path| path == &url.path) { diff --git a/gix/src/create.rs b/gix/src/create.rs index 8963315f5b4..42ffc534977 100644 --- a/gix/src/create.rs +++ b/gix/src/create.rs @@ -160,7 +160,7 @@ pub fn into( if dot_git.is_dir() { return Err(Error::DirectoryExists { path: dot_git }); } - }; + } create_dir(&dot_git)?; { diff --git a/gix/src/object/blob.rs b/gix/src/object/blob.rs index c07fd319832..2f96690edd7 100644 --- a/gix/src/object/blob.rs +++ b/gix/src/object/blob.rs @@ -123,7 +123,7 @@ pub mod diff { unreachable!("we disabled that") } Operation::SourceOrDestinationIsBinary => {} - }; + } Ok(prep) } diff --git a/gix/src/remote/build.rs b/gix/src/remote/build.rs index 16243900d9b..45e99fff69e 100644 --- a/gix/src/remote/build.rs +++ b/gix/src/remote/build.rs @@ -40,9 +40,11 @@ impl Remote<'_> { ) -> Result { self.push_url = push_url.into(); - let (_, push_url_alias) = should_rewrite_urls - .then(|| remote::init::rewrite_urls(&self.repo.config, None, self.push_url.as_ref())) - .unwrap_or(Ok((None, None)))?; + let (_, push_url_alias) = if should_rewrite_urls { + remote::init::rewrite_urls(&self.repo.config, None, self.push_url.as_ref()) + } else { + Ok((None, None)) + }?; self.push_url_alias = push_url_alias; Ok(self) diff --git a/gix/src/remote/connection/fetch/update_refs/mod.rs b/gix/src/remote/connection/fetch/update_refs/mod.rs index 640b028865e..a692249f2a8 100644 --- a/gix/src/remote/connection/fetch/update_refs/mod.rs +++ b/gix/src/remote/connection/fetch/update_refs/mod.rs @@ -314,7 +314,7 @@ pub(crate) fn update( Change::Delete { .. } => { unreachable!("we don't do that here") } - }; + } } } @@ -376,7 +376,7 @@ fn update_needs_adjustment_as_edits_symbolic_target_is_missing( Change::Delete { .. } => { unreachable!("we don't ever delete here") } - }; + } let target_ref_exists_locally = repo.refs.try_find(new_target_ref).ok().flatten().is_some(); if target_ref_exists_locally { return false; diff --git a/gix/src/remote/connection/ref_map.rs b/gix/src/remote/connection/ref_map.rs index 36d5fb27d8e..95d92a40ad5 100644 --- a/gix/src/remote/connection/ref_map.rs +++ b/gix/src/remote/connection/ref_map.rs @@ -111,7 +111,7 @@ where if !extra_refspecs.contains(&tag_spec) { extra_refspecs.push(tag_spec); } - }; + } let mut credentials_storage; let url = self.transport.inner.to_url(); let authenticate = match self.authenticate.as_mut() { diff --git a/gix/src/remote/init.rs b/gix/src/remote/init.rs index fd81604b257..418ab64c2bb 100644 --- a/gix/src/remote/init.rs +++ b/gix/src/remote/init.rs @@ -40,9 +40,11 @@ impl<'repo> Remote<'repo> { url.is_some() || push_url.is_some(), "BUG: fetch or push url must be set at least" ); - let (url_alias, push_url_alias) = should_rewrite_urls - .then(|| rewrite_urls(&repo.config, url.as_ref(), push_url.as_ref())) - .unwrap_or(Ok((None, None)))?; + let (url_alias, push_url_alias) = if should_rewrite_urls { + rewrite_urls(&repo.config, url.as_ref(), push_url.as_ref()) + } else { + Ok((None, None)) + }?; Ok(Remote { name: name_or_url.map(Into::into), url, @@ -77,9 +79,11 @@ impl<'repo> Remote<'repo> { should_rewrite_urls: bool, repo: &'repo Repository, ) -> Result { - let (url_alias, _) = should_rewrite_urls - .then(|| rewrite_urls(&repo.config, Some(&url), None)) - .unwrap_or(Ok((None, None)))?; + let (url_alias, _) = if should_rewrite_urls { + rewrite_urls(&repo.config, Some(&url), None) + } else { + Ok((None, None)) + }?; Ok(Remote { name: None, url: Some(url), diff --git a/gix/src/remote/url/rewrite.rs b/gix/src/remote/url/rewrite.rs index ae0eee4267d..d1a37e9f228 100644 --- a/gix/src/remote/url/rewrite.rs +++ b/gix/src/remote/url/rewrite.rs @@ -89,7 +89,7 @@ impl Rewrite { *bytes_matched = replace.find.len(); *prev_rewrite_with = replace.with.as_slice().into(); } - }; + } acc }) .map(|(bytes_matched, replace_with)| { diff --git a/gix/src/repository/config/branch.rs b/gix/src/repository/config/branch.rs index d9d231460ad..74bf0a887d1 100644 --- a/gix/src/repository/config/branch.rs +++ b/gix/src/repository/config/branch.rs @@ -272,11 +272,8 @@ fn matching_remote<'a>( }) .into_iter(), ); - out.mappings.into_iter().next().and_then(|m| { - m.rhs.map(|name| { - FullName::try_from(name.into_owned()) - .map(Cow::Owned) - .map_err(Into::into) - }) - }) + out.mappings + .into_iter() + .next() + .and_then(|m| m.rhs.map(|name| FullName::try_from(name.into_owned()).map(Cow::Owned))) } diff --git a/gix/src/repository/init.rs b/gix/src/repository/init.rs index 3832dfba39a..1c35b7f916b 100644 --- a/gix/src/repository/init.rs +++ b/gix/src/repository/init.rs @@ -51,7 +51,7 @@ pub(crate) fn setup_objects(objects: &mut crate::OdbHandle, config: &crate::conf Some(bytes) => objects.set_pack_cache(move || -> Box { Box::new(gix_pack::cache::lru::MemoryCappedHashmap::new(bytes)) }), - }; + } if config.object_cache_bytes == 0 { objects.unset_object_cache(); } else { diff --git a/gix/src/revision/spec/parse/delegate/mod.rs b/gix/src/revision/spec/parse/delegate/mod.rs index 74aeaa1b361..8baf3c03213 100644 --- a/gix/src/revision/spec/parse/delegate/mod.rs +++ b/gix/src/revision/spec/parse/delegate/mod.rs @@ -56,24 +56,22 @@ impl<'repo> Delegate<'repo> { let candidates = candidates.take(); match candidates { None => *out = None, - Some(candidates) => { - match candidates.len() { - 0 => unreachable!( - "BUG: let's avoid still being around if no candidate matched the requirements" - ), - 1 => { - *out = candidates.into_iter().next(); - } - _ => { - errors.insert( - 0, - Error::ambiguous(candidates, prefix.expect("set when obtaining candidates"), repo), - ); - return Err(Error::from_errors(errors)); - } - }; - } - }; + Some(candidates) => match candidates.len() { + 0 => { + unreachable!("BUG: let's avoid still being around if no candidate matched the requirements") + } + 1 => { + *out = candidates.into_iter().next(); + } + _ => { + errors.insert( + 0, + Error::ambiguous(candidates, prefix.expect("set when obtaining candidates"), repo), + ); + return Err(Error::from_errors(errors)); + } + }, + } } Ok(out) } @@ -215,8 +213,8 @@ impl Delegate<'_> { } }) { obj_opt.get_or_insert_with(HashSet::default).insert(id); - }; - }; + } + } } Some(()) } diff --git a/gix/src/revision/spec/parse/delegate/revision.rs b/gix/src/revision/spec/parse/delegate/revision.rs index 2beb98ff828..3e021deec19 100644 --- a/gix/src/revision/spec/parse/delegate/revision.rs +++ b/gix/src/revision/spec/parse/delegate/revision.rs @@ -283,7 +283,7 @@ impl delegate::Revision for Delegate<'_> { return Some(()); } }, - }; + } None } } diff --git a/gix/src/revision/walk.rs b/gix/src/revision/walk.rs index 9d62e474892..004df027b9e 100644 --- a/gix/src/revision/walk.rs +++ b/gix/src/revision/walk.rs @@ -286,13 +286,13 @@ impl<'repo> Platform<'repo> { if let Ok(idx) = grafted_parents_to_skip.binary_search(&id) { grafted_parents_to_skip.remove(idx); return false; - }; + } if commits.binary_search(&id).is_ok() { if let Ok(commit) = repo.objects.find_commit_iter(&id, &mut buf) { grafted_parents_to_skip.extend(commit.parent_ids()); grafted_parents_to_skip.sort(); } - }; + } true } None => true, diff --git a/gix/src/status/iter/mod.rs b/gix/src/status/iter/mod.rs index 971297f6ee7..5b6ad9e4e19 100644 --- a/gix/src/status/iter/mod.rs +++ b/gix/src/status/iter/mod.rs @@ -327,7 +327,7 @@ impl Iter { self.index_changes.push((entry_index, ApplyChange::SetSizeToZero)); } _ => {} - }; + } Some(item) } } diff --git a/gix/tests/gix/object/tree/diff.rs b/gix/tests/gix/object/tree/diff.rs index 36a25e86c17..ce6401c83f4 100644 --- a/gix/tests/gix/object/tree/diff.rs +++ b/gix/tests/gix/object/tree/diff.rs @@ -50,7 +50,7 @@ fn changes_against_tree_modified() -> crate::Result { Change::Rewrite { .. } | Change::Deletion { .. } | Change::Addition { .. } => { unreachable!("only modification is expected") } - }; + } let mut diff = change.diff(&mut cache).expect("objects available"); let count = diff.line_counts().expect("no diff error").expect("no binary blobs"); @@ -63,15 +63,14 @@ fn changes_against_tree_modified() -> crate::Result { assert_eq!(lines.len(), 1); assert_eq!( lines[0], - expected_data[expected_previous_data.len()..] - .as_bytes() + expected_data.as_bytes()[expected_previous_data.len()..] .as_bstr() .trim(), "diffed lines don't have newlines anymore" ); } lines::Change::Modification { .. } => unreachable!("there was no modification"), - }; + } Ok::<_, Infallible>(()) }) .expect("infallible"); diff --git a/gix/tests/gix/repository/excludes.rs b/gix/tests/gix/repository/excludes.rs index 5904b4be425..0ae733c32cc 100644 --- a/gix/tests/gix/repository/excludes.rs +++ b/gix/tests/gix/repository/excludes.rs @@ -19,7 +19,7 @@ fn empty_core_excludes() -> crate::Result { "The value for `core.excludesFile` could not be read from configuration" ); } - }; + } let repo = gix::open_opts(repo.git_dir(), repo.open_options().clone().strict_config(false))?; repo.excludes(&index, None, Source::WorktreeThenIdMappingIfNotSkipped) diff --git a/src/shared.rs b/src/shared.rs index 6fbad8a1f0d..610372416c0 100644 --- a/src/shared.rs +++ b/src/shared.rs @@ -327,7 +327,7 @@ mod clap { #[derive(Clone)] pub struct AsPathSpec; - static PATHSPEC_DEFAULTS: once_cell::sync::Lazy = once_cell::sync::Lazy::new(|| { + static PATHSPEC_DEFAULTS: std::sync::LazyLock = std::sync::LazyLock::new(|| { gix::pathspec::Defaults::from_environment(&mut |n| std::env::var_os(n)).unwrap_or_default() }); diff --git a/tests/it/src/commands/check_mode.rs b/tests/it/src/commands/check_mode.rs index 35f95d78cad..02a2ac91430 100644 --- a/tests/it/src/commands/check_mode.rs +++ b/tests/it/src/commands/check_mode.rs @@ -1,7 +1,7 @@ pub(super) mod function { use anyhow::{bail, Context}; use gix::bstr::ByteSlice; - use once_cell::sync::Lazy; + use regex::bytes::Regex; use std::ffi::{OsStr, OsString}; use std::io::{BufRead, BufReader, Read}; @@ -66,7 +66,7 @@ pub(super) mod function { /// On mismatch, report it and return `Some(true)`. fn check_for_mismatch(root: &OsStr, record: &[u8]) -> anyhow::Result { - static RECORD_REGEX: Lazy = Lazy::new(|| { + static RECORD_REGEX: std::sync::LazyLock = std::sync::LazyLock::new(|| { let pattern = r"(?-u)\A([0-7]+) ([[:xdigit:]]+) [[:digit:]]+\t(.+)\z"; Regex::new(pattern).expect("regex should be valid") }); diff --git a/tests/tools/src/main.rs b/tests/tools/src/main.rs index 99d944e32af..4a79bdfda1f 100644 --- a/tests/tools/src/main.rs +++ b/tests/tools/src/main.rs @@ -21,6 +21,6 @@ fn main() -> Result<(), Box> { #[cfg(unix)] "umask" => umask()?, _ => unreachable!("Unknown subcommand: {}", scmd), - }; + } Ok(()) } From 0e9299c65e2fca1af734c5e94735920e5ffe6592 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 22 Feb 2025 15:58:58 +0100 Subject: [PATCH 2/4] make auditing pass the hard way --- deny.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deny.toml b/deny.toml index d0c6a98beb1..67b22b3e42d 100644 --- a/deny.toml +++ b/deny.toml @@ -8,7 +8,7 @@ # More documentation for the advisories section can be found here: # https://embarkstudios.github.io/cargo-deny/checks/advisories/cfg.html [advisories] -ignore = [] +ignore = ['RUSTSEC-2025-0007'] From cf98a159feb6a23dbe47887cd2744c9db93430aa Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 22 Feb 2025 17:11:41 +0100 Subject: [PATCH 3/4] Adjust test expectations to the new newline that panic! now prints --- tests/snapshots/panic-behaviour/expected-failure | 1 + tests/snapshots/panic-behaviour/expected-failure-in-thread | 1 + .../panic-behaviour/expected-failure-in-thread-with-progress | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/snapshots/panic-behaviour/expected-failure b/tests/snapshots/panic-behaviour/expected-failure index 9c6bf892c21..0cf65deb235 100644 --- a/tests/snapshots/panic-behaviour/expected-failure +++ b/tests/snapshots/panic-behaviour/expected-failure @@ -1,3 +1,4 @@ + thread 'main' panicked at src/porcelain/main.rs:40:42: something went very wrong note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace \ No newline at end of file diff --git a/tests/snapshots/panic-behaviour/expected-failure-in-thread b/tests/snapshots/panic-behaviour/expected-failure-in-thread index 8ef1ef6a67b..2c58afa0cea 100644 --- a/tests/snapshots/panic-behaviour/expected-failure-in-thread +++ b/tests/snapshots/panic-behaviour/expected-failure-in-thread @@ -1,3 +1,4 @@ + thread 'main' panicked at src/porcelain/main.rs:40:42: something went very wrong note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/snapshots/panic-behaviour/expected-failure-in-thread-with-progress b/tests/snapshots/panic-behaviour/expected-failure-in-thread-with-progress index d1035857ddf..aaf85f87371 100644 --- a/tests/snapshots/panic-behaviour/expected-failure-in-thread-with-progress +++ b/tests/snapshots/panic-behaviour/expected-failure-in-thread-with-progress @@ -1,4 +1,5 @@ -[?1049h[?25lthread '' panicked at src/porcelain/main.rs:40:42: +[?1049h[?25l +thread '' panicked at src/porcelain/main.rs:40:42: something went very wrong note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace [?25h[?1049l \ No newline at end of file From d28ff1b2e1ce98011e8b11dc7639b1e2fa42cf05 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 22 Feb 2025 14:41:07 +0100 Subject: [PATCH 4/4] Report for February 2025 --- etc/reports/25-02.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 etc/reports/25-02.md diff --git a/etc/reports/25-02.md b/etc/reports/25-02.md new file mode 100644 index 00000000000..3d0cd9b115f --- /dev/null +++ b/etc/reports/25-02.md @@ -0,0 +1,32 @@ +Like the previous month was the first in 2025 with plenty of news to share, this month is a first as well: I seem to have nothing to write about. + +Sure, there were a couple of smaller API improvements, but nothing that would inspire me. +So what did I do all this time? Probably this is the moment where there really is no other way but to talk about GitButler, something I avoided last month just because it doesn't seem to belong into the `gitoxide` newsletter. + +## GitButler + +[GitButler](https://gitbutler.com) is what I have been working on intensely for the last two months effectively, in a push to help it to unfold its true potential. Thus far it was mostly powered by `git2`, with `gitoxide` sprinkled in there, but the next iteration will be the inverse with `git2` only being used where `gitoxide` is lacking a feature. That way, along with massive architectural changes, it will be able to cope with large repositories and be more compatible with various Git features, too. + +I cannot wait to see all this work to finally come to fruition, and of course, to also see myself being pulled to a user interface that truly elevates my workflow and the workflow of other devs just like me who thus far preferred to stay on the command-line. + +## Community + +### Faster `gix blame` + +Christoph Rüßler kept working and managed to greatly improve the `gix blame` performance while increasing its conformance to Git at the same time. This means that now, depending on the sample, `gix blame` *can* be a bit faster than Git, but it typically is still up to 30% slower when commitgraph caches are used. Overall though, the performance is nothing to sneeze at, and it competes quite well except for in pathological cases. +Admittedly, I am quite blown away by the performance and have a feeling that last time I checked, I didn't use the latest version of the `gix` binary. +It's worth noting that rename-tracking still isn't support, but I also see no reason why it shouldn't be eventually, a feature that would make `gix blame` so much more useful in practice. + +### `gix blame` with experimental cache + +A pretty [slim PR](https://github.com/GitoxideLabs/gitoxide/pull/1852) shows how to use a special cache to greatly speedup blames, from ~300ms down to just ~4ms, a massive 75x speedup that would be very useful for editors and IDEs, or forges, I am sure! +Of course, one first has to build such cache, and probably do so per file, but I am sure there are plenty of use-cases for it when it's driven by dev tooling. + +### Gix in Cargo + +With `gix status` now available I am planning to integrate it as soon as possible! That didn't happen yet, but… it will, the stack to work off before I can start this is pretty high though so it's unlikely to happen anytime soon. + +Cheers +Sebastian + +PS: The latest timesheets can be found [here (2025)](https://github.com/Byron/byron/blob/main/timesheets/2025.csv). \ No newline at end of file