From 565183b9e8a602c1d0c3343c3b92b0e0bb9d4b3e Mon Sep 17 00:00:00 2001 From: Perry Hertler Date: Wed, 19 Aug 2026 13:25:39 -0500 Subject: [PATCH 1/2] Remove needless borrows in format arguments Rust 1.97's clippy flags `&x` passed to format-like macros where the borrow is redundant, since Display and Debug forward transparently through references. Drop the borrow in the 8 affected call sites. Formatted output is byte-identical; no logic or error paths change. Landed ahead of the toolchain bump so each commit passes clippy on its own (verified clean under both 1.90 and 1.97). Co-Authored-By: Claude Fable 5 --- src/packs.rs | 10 +++------- src/packs/checker.rs | 6 +++--- src/packs/checker/layer.rs | 2 +- src/packs/checker/reference.rs | 6 +++--- src/packs/creator.rs | 4 ++-- src/packs/pack.rs | 6 +++--- src/packs/parsing/ruby/parse_utils.rs | 2 +- tests/common/mod.rs | 2 +- 8 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/packs.rs b/src/packs.rs index 128a4bb..0202a40 100644 --- a/src/packs.rs +++ b/src/packs.rs @@ -65,10 +65,10 @@ pub fn create( ) -> anyhow::Result<()> { match creator::create(configuration, &name)? { CreateResult::AlreadyExists => { - println!("`{}` already exists!", &name); + println!("`{}` already exists!", name); } CreateResult::Success => { - println!("Successfully created `{}`!", &name); + println!("Successfully created `{}`!", name); } } Ok(()) @@ -246,11 +246,7 @@ pub fn lint_package_yml_files( pub fn delete_cache(configuration: Configuration) { let absolute_cache_dir = configuration.cache_directory; if let Err(err) = std::fs::remove_dir_all(&absolute_cache_dir) { - eprintln!( - "Failed to remove {}: {}", - &absolute_cache_dir.display(), - err - ); + eprintln!("Failed to remove {}: {}", absolute_cache_dir.display(), err); } } diff --git a/src/packs/checker.rs b/src/packs/checker.rs index cfd694b..ffd336f 100644 --- a/src/packs/checker.rs +++ b/src/packs/checker.rs @@ -167,7 +167,7 @@ impl<'a> CheckAllBuilder<'a> { .map_err(|e| { anyhow::Error::new(e).context(format!( "Failed to strip prefix from {:?}", - &self.configuration.absolute_root + self.configuration.absolute_root )) }) .and_then(|path| { @@ -175,7 +175,7 @@ impl<'a> CheckAllBuilder<'a> { anyhow::Error::new(std::fmt::Error).context( format!( "Path ({:?}) cannot be converted to &str", - &path + path ), ) }) @@ -314,7 +314,7 @@ pub(crate) fn update(configuration: &Configuration) -> anyhow::Result<()> { } println!( "{} strict mode violation(s) detected. These violations must be fixed for `check` to succeed.", - &strict_violations.len() + strict_violations.len() ); } package_todo::write_violations_to_disk(configuration, violations); diff --git a/src/packs/checker/layer.rs b/src/packs/checker/layer.rs index 2805657..06280d4 100644 --- a/src/packs/checker/layer.rs +++ b/src/packs/checker/layer.rs @@ -53,7 +53,7 @@ impl Checker { } else { Some(format!( "Invalid 'layer' option in '{}'. `layer` must be one of the layers defined in `packwerk.yml`", - &pack.relative_yml().to_string_lossy() + pack.relative_yml().to_string_lossy() )) } } diff --git a/src/packs/checker/reference.rs b/src/packs/checker/reference.rs index 570f593..7157ca8 100644 --- a/src/packs/checker/reference.rs +++ b/src/packs/checker/reference.rs @@ -27,7 +27,7 @@ impl Reference { .for_pack(name) .context(format!( "Reference#defining_pack_name is {}, but that pack is not found in pack set.", - &name + name ))?)) } else { Ok(None) @@ -40,7 +40,7 @@ impl Reference { ) -> anyhow::Result<&'a Pack> { pack_set.for_pack(&self.referencing_pack_name). context(format!("Reference#referencing_pack_name is {}, but that pack is not found in pack set.", - &self.referencing_pack_name)) + self.referencing_pack_name)) } } @@ -59,7 +59,7 @@ impl Reference { Some(pack_name) => pack_name, None => bail!( "Could not find pack for referencing file path: {}", - &referencing_file_path.display() + referencing_file_path.display() ), }; diff --git a/src/packs/creator.rs b/src/packs/creator.rs index 7eefa8b..127b771 100644 --- a/src/packs/creator.rs +++ b/src/packs/creator.rs @@ -40,11 +40,11 @@ pub fn create( .next_back() .context("unable to find pack name")?; std::fs::create_dir_all(new_pack_path.join("app/public/").join(pack_name)) - .context(format!("failed to create app/public/{}", &name))?; + .context(format!("failed to create app/public/{}", name))?; std::fs::create_dir_all( new_pack_path.join("app/services/").join(pack_name), ) - .context(format!("failed to create app/services/{}", &name))?; + .context(format!("failed to create app/services/{}", name))?; if is_rails(configuration) { std::fs::create_dir_all(new_pack_path.join("app/controllers/")) .context("failed to create app/controllers")?; diff --git a/src/packs/pack.rs b/src/packs/pack.rs index d3a9199..6c1fd2d 100644 --- a/src/packs/pack.rs +++ b/src/packs/pack.rs @@ -428,20 +428,20 @@ pub fn write_pack_to_disk(pack: &Pack) -> anyhow::Result<()> { let pack_dir = pack.yml.parent().ok_or_else(|| { anyhow::Error::new(std::io::Error::new( std::io::ErrorKind::NotFound, - format!("Failed to get parent directory of pack {:?}", &pack.yml), + format!("Failed to get parent directory of pack {:?}", pack.yml), )) })?; std::fs::create_dir_all(pack_dir).map_err(|e| { anyhow::Error::new(e).context(format!( "Failed to create directory for pack {:?}", - &pack_dir + pack_dir )) })?; std::fs::write(&pack.yml, serialized_pack).map_err(|e| { anyhow::Error::new(e) - .context(format!("Failed to write pack to disk {:?}", &pack.yml)) + .context(format!("Failed to write pack to disk {:?}", pack.yml)) })?; Ok(()) diff --git a/src/packs/parsing/ruby/parse_utils.rs b/src/packs/parsing/ruby/parse_utils.rs index e589ed2..5a69622 100644 --- a/src/packs/parsing/ruby/parse_utils.rs +++ b/src/packs/parsing/ruby/parse_utils.rs @@ -148,7 +148,7 @@ pub fn get_reference_from_active_record_association( // Later we should probably handle these cases! if name.is_some() { let unwrapped_name = name.unwrap_or_else(|| { - panic!("Could not find class name for association {:?}", &node,) + panic!("Could not find class name for association {:?}", node) }); Some(UnresolvedReference { diff --git a/tests/common/mod.rs b/tests/common/mod.rs index eb09c23..92668ca 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -13,7 +13,7 @@ pub fn teardown() { if let Err(err) = fs::remove_dir_all(&cache_dir) { eprintln!( "Failed to remove {} during test teardown: {}", - &cache_dir.display(), + cache_dir.display(), err ); } From 6e25d060cb1fe70307e5a769bb32f710c434c6cd Mon Sep 17 00:00:00 2001 From: Perry Hertler Date: Wed, 19 Aug 2026 13:30:11 -0500 Subject: [PATCH 2/2] Bump Rust toolchain to 1.97.1 Moves off 1.92.0 to current stable. No CI workflow pins a Rust version, so all jobs pick this up from rust-toolchain.toml automatically. Co-Authored-By: Claude Fable 5 --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 808dff7..efba89c 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.92.0" +channel = "1.97.1" components = ["clippy", "rustfmt"] targets = ["x86_64-apple-darwin", "aarch64-apple-darwin", "x86_64-unknown-linux-gnu"]