diff --git a/content-addressed-cache/src/synchronizer.rs b/content-addressed-cache/src/synchronizer.rs index f60ef907..97b80e6b 100644 --- a/content-addressed-cache/src/synchronizer.rs +++ b/content-addressed-cache/src/synchronizer.rs @@ -300,7 +300,7 @@ impl CacheSynchronizer for GitBackedCacheSynchronizer { &vec_of_prev_commit_references[..], )?; - let refspecs = vec![refspec_fmt(&self.namespace, &keyset_id)]; + let refspecs = vec![refspec_fmt(&self.namespace, keyset_id)]; self.repo .reference( @@ -593,7 +593,7 @@ mod tests { #[test] pub fn refspec_formatting() { - assert_eq!(refspec_fmt("cache", &keyset_id_1()), String::from("+refs/tags/cache/abcd1abcd1abcd1abcd100000000000000000000:refs/tags/cache/abcd1abcd1abcd1abcd100000000000000000000")); + assert_eq!(refspec_fmt("cache", keyset_id_1()), String::from("+refs/tags/cache/abcd1abcd1abcd1abcd100000000000000000000:refs/tags/cache/abcd1abcd1abcd1abcd100000000000000000000")); assert_eq!( refspec_fmt("cache", "foo"), String::from("+refs/tags/cache/foo:refs/tags/cache/foo") @@ -603,7 +603,7 @@ mod tests { #[test] pub fn tag_formatting() { assert_eq!( - tag_fmt("cache", &keyset_id_1()), + tag_fmt("cache", keyset_id_1()), String::from("refs/tags/cache/abcd1abcd1abcd1abcd100000000000000000000"), ); assert_eq!(tag_fmt("cache", "foo"), String::from("refs/tags/cache/foo")); diff --git a/focus/internals/src/lib/model/persistence.rs b/focus/internals/src/lib/model/persistence.rs index c8a497a9..9d9125c5 100644 --- a/focus/internals/src/lib/model/persistence.rs +++ b/focus/internals/src/lib/model/persistence.rs @@ -138,7 +138,7 @@ impl FileBackedCollection { let path = self.make_path(name); debug!(?path, %name, "Insert"); self.underlying.insert(name.to_owned(), entity.clone()); - store_model(&path.as_path(), entity) + store_model(path.as_path(), entity) } /// Remove an entity by name from the `underlying` cache and erase it from disk. @@ -179,7 +179,7 @@ impl FileBackedCollection { { for (name, entity) in self.underlying.iter() { let path = self.make_path(name); - store_model(&path.as_path(), entity) + store_model(path.as_path(), entity) .with_context(|| format!("Storing entity to {}", path.display()))? } @@ -198,7 +198,7 @@ impl FileBackedCollection { serde_json::to_string(entity)?, path.display() ); - store_model(&path.as_path(), entity) + store_model(path.as_path(), entity) .with_context(|| format!("Storing entity to {}", path.display())) } } @@ -226,8 +226,8 @@ mod tests { focus_testing::init_logging(); let dir = tempfile::tempdir()?; - let mut collection = make_collection(&dir.path())?; - let mut alternate_collection = make_collection(&dir.path())?; + let mut collection = make_collection(dir.path())?; + let mut alternate_collection = make_collection(dir.path())?; let name = "jeff"; collection.insert( @@ -259,7 +259,7 @@ mod tests { let dir = tempfile::tempdir()?; let name = "lebowski"; { - let mut collection = make_collection(&dir.path())?; + let mut collection = make_collection(dir.path())?; collection.insert( name, @@ -287,7 +287,7 @@ mod tests { } { - let collection = make_collection(&dir.path())?; + let collection = make_collection(dir.path())?; let (actual_name, entity) = collection.underlying.iter().next().unwrap(); assert_eq!(actual_name, name); assert_eq!(entity.name, "Maude Lebowski"); @@ -301,7 +301,7 @@ mod tests { focus_testing::init_logging(); let dir = tempfile::tempdir()?; { - let mut collection = make_collection(&dir.path())?; + let mut collection = make_collection(dir.path())?; { collection.underlying.insert( String::from("foo"), @@ -321,7 +321,7 @@ mod tests { } { - let collection = make_collection(&dir.path())?; + let collection = make_collection(dir.path())?; assert!(collection.underlying.contains_key("foo")); assert!(collection.underlying.contains_key("bar")); } diff --git a/focus/internals/src/lib/model/repo.rs b/focus/internals/src/lib/model/repo.rs index fcf10e6e..952e16c2 100644 --- a/focus/internals/src/lib/model/repo.rs +++ b/focus/internals/src/lib/model/repo.rs @@ -695,7 +695,7 @@ pub struct Repo { impl Repo { pub fn open(path: &Path, app: Arc) -> Result { - let repo = git2::Repository::open(&path) + let repo = git2::Repository::open(path) .with_context(|| format!("Opening repo {}", path.display())) .context("Failed to open repo")?; if repo.is_bare() { diff --git a/focus/internals/src/lib/project_cache/local_cache_backend.rs b/focus/internals/src/lib/project_cache/local_cache_backend.rs index 2aba3a62..6211f061 100644 --- a/focus/internals/src/lib/project_cache/local_cache_backend.rs +++ b/focus/internals/src/lib/project_cache/local_cache_backend.rs @@ -42,7 +42,7 @@ impl LocalCacheBackend { impl ProjectCacheBackend for LocalCacheBackend { fn load_model(&self, url: Url) -> Result> { let key = url.path(); - if let Ok(Some(repr)) = self.database.borrow().get(&key) { + if let Ok(Some(repr)) = self.database.borrow().get(key) { debug!(?key, "GET: Found"); Ok(repr) } else { @@ -55,7 +55,7 @@ impl ProjectCacheBackend for LocalCacheBackend { let key = url.path(); debug!(?key, "PUT"); self.database - .put(&key, value) + .put(key, value) .with_context(|| format!("Writing key '{}' failed", &key)) } diff --git a/focus/internals/src/lib/project_cache/remote.rs b/focus/internals/src/lib/project_cache/remote.rs index 8e25db1a..f2a13008 100644 --- a/focus/internals/src/lib/project_cache/remote.rs +++ b/focus/internals/src/lib/project_cache/remote.rs @@ -36,7 +36,7 @@ fn manifest_path(backend: &dyn ProjectCacheBackend, build_graph_hash: &Vec) let path = format!( "{}/{}.manifest_v{}.json.gz", url.path(), - hex::encode(&build_graph_hash).as_str(), + hex::encode(build_graph_hash).as_str(), PROJECT_CACHE_VERSION, ); url.set_path(&path); @@ -53,7 +53,7 @@ fn export_path( let path = format!( "{}/{}_{}_{}.export_v{}.json.gz", url.path(), - hex::encode(&build_graph_hash).as_str(), + hex::encode(build_graph_hash).as_str(), shard_index + 1, shard_count, PROJECT_CACHE_VERSION, diff --git a/focus/operations/src/clone.rs b/focus/operations/src/clone.rs index dcc152d0..590651b2 100644 --- a/focus/operations/src/clone.rs +++ b/focus/operations/src/clone.rs @@ -29,7 +29,7 @@ use tracing::{debug, error, info, info_span, warn}; use url::Url; pub fn run_clone(mut clone_builder: CloneBuilder, app: Arc) -> Result<()> { - (&mut clone_builder).add_clone_args(vec!["--progress"]); + clone_builder.add_clone_args(vec!["--progress"]); let (mut cmd, scmd) = clone_builder.build(app)?; scmd.ensure_success_or_log(&mut cmd, SandboxCommandOutput::Stderr) @@ -487,7 +487,7 @@ fn clone_local( } let dense_repo = Repository::open(&dense_repo_path).context("Opening dense repo")?; - let sparse_repo = Repository::open(&sparse_repo_path).context("Opening sparse repo")?; + let sparse_repo = Repository::open(sparse_repo_path).context("Opening sparse repo")?; if copy_branches { let span = info_span!("Copying branches"); @@ -868,7 +868,7 @@ fn set_up_hooks(sparse_repo: &Path) -> Result<()> { fn fetch_default_remote(sparse_repo: &Path, app: Arc) -> Result<()> { let (mut cmd, scmd) = git_helper::git_command(app)?; let _ = scmd.ensure_success_or_log( - cmd.current_dir(&sparse_repo).arg("fetch").arg("origin"), + cmd.current_dir(sparse_repo).arg("fetch").arg("origin"), SandboxCommandOutput::Stderr, )?; @@ -1280,7 +1280,7 @@ mod twttr_test { .map(|m| { m.unwrap() .path() - .strip_prefix(&outlining_tree_path) + .strip_prefix(outlining_tree_path) .unwrap() .to_owned() }) @@ -1308,7 +1308,7 @@ mod twttr_test { .map(|m| { m.unwrap() .path() - .strip_prefix(&working_tree_path) + .strip_prefix(working_tree_path) .unwrap() .to_owned() }) diff --git a/focus/operations/src/detect_build_graph_changes.rs b/focus/operations/src/detect_build_graph_changes.rs index 4bd4071e..aa62214b 100644 --- a/focus/operations/src/detect_build_graph_changes.rs +++ b/focus/operations/src/detect_build_graph_changes.rs @@ -37,7 +37,7 @@ fn find_committed_changes(app: Arc, repo_path: &Path) -> Result::new(); for line in output.lines() { let parsed = PathBuf::from(line); @@ -51,7 +51,7 @@ fn find_committed_changes(app: Arc, repo_path: &Path) -> Result, repo: &Path) -> Result> { let output = - git_helper::run_consuming_stdout(repo, &["status", "--porcelain", "--no-renames"], app)?; + git_helper::run_consuming_stdout(repo, ["status", "--porcelain", "--no-renames"], app)?; let mut build_involved_changed_paths = Vec::::new(); for line in output.lines() { let mut tokens = line.split_ascii_whitespace().take(2); diff --git a/focus/operations/src/maintenance/mod.rs b/focus/operations/src/maintenance/mod.rs index d037c5ab..9522bbb7 100644 --- a/focus/operations/src/maintenance/mod.rs +++ b/focus/operations/src/maintenance/mod.rs @@ -584,7 +584,7 @@ mod tests { fn assert_repo_defaults_set(config: &git2::Config) { for (k, v) in CONFIG_DEFAULTS.iter() { - let val = config.get_string(*k).unwrap(); + let val = config.get_string(k).unwrap(); assert_eq!( val, *v, "values for key {} were not equal: {} != {}", diff --git a/focus/operations/src/pull.rs b/focus/operations/src/pull.rs index 9661c6f2..74784ef6 100644 --- a/focus/operations/src/pull.rs +++ b/focus/operations/src/pull.rs @@ -151,14 +151,14 @@ pub(crate) mod testing { // Create `refs/focus/sync` let _ = git_helper::run_consuming_stdout( repo_dir, - &["update-ref", "refs/focus/sync", &head], + ["update-ref", "refs/focus/sync", &head], app.clone(), )?; // Create a default prefetch ref let _ = git_helper::run_consuming_stdout( repo_dir, - &["update-ref", "refs/prefetch/remotes/origin/master", &head], + ["update-ref", "refs/prefetch/remotes/origin/master", &head], app.clone(), )?; @@ -168,7 +168,7 @@ pub(crate) mod testing { // Create a default remote ref let _ = git_helper::run_consuming_stdout( repo_dir, - &["update-ref", "refs/remotes/origin/master", &head], + ["update-ref", "refs/remotes/origin/master", &head], app.clone(), )?; @@ -185,7 +185,7 @@ pub(crate) mod testing { // Update prefetch default to new commit let _ = git_helper::run_consuming_stdout( repo_dir, - &[ + [ "update-ref", "refs/prefetch/remotes/origin/master", &new_commit, @@ -194,7 +194,7 @@ pub(crate) mod testing { )?; // Switch back to `main` branch - let _ = git_helper::run_consuming_stdout(repo_dir, &["checkout", "main"], app.clone())?; + let _ = git_helper::run_consuming_stdout(repo_dir, ["checkout", "main"], app.clone())?; // Since focus/sync still points to `main` HEAD, merge base validation should still fail assert!(validate_merge_base(app.clone(), repo_dir).is_err()); @@ -202,7 +202,7 @@ pub(crate) mod testing { // Update focus/sync to new commit let _ = git_helper::run_consuming_stdout( repo_dir, - &["update-ref", "refs/focus/sync", &new_commit], + ["update-ref", "refs/focus/sync", &new_commit], app.clone(), )?; diff --git a/focus/operations/src/testing/integration.rs b/focus/operations/src/testing/integration.rs index 7fd9017d..58ed9968 100644 --- a/focus/operations/src/testing/integration.rs +++ b/focus/operations/src/testing/integration.rs @@ -171,7 +171,7 @@ impl RepoPairFixture { .command() .arg("fetch") .arg(remote_name) - .current_dir(&path) + .current_dir(path) .assert() .success(); let fetch_head_path = path.join(".git").join("FETCH_HEAD"); @@ -195,7 +195,7 @@ impl RepoPairFixture { .arg("pull") .arg(remote_name) .arg(branch) - .current_dir(&path) + .current_dir(path) .assert() .success(); diff --git a/focus/testing/src/scratch_git_repo.rs b/focus/testing/src/scratch_git_repo.rs index 83d8ebb4..499bf62c 100644 --- a/focus/testing/src/scratch_git_repo.rs +++ b/focus/testing/src/scratch_git_repo.rs @@ -86,7 +86,7 @@ impl ScratchGitRepo { .arg("add") .arg("--") .arg(".") - .current_dir(&destination_path) + .current_dir(destination_path) .assert() .success(); @@ -95,7 +95,7 @@ impl ScratchGitRepo { .arg("commit") .arg("-m") .arg("Initial import") - .current_dir(&destination_path) + .current_dir(destination_path) .assert() .success(); @@ -227,7 +227,7 @@ impl ScratchGitRepo { qualified_origin.push(origin.as_os_str()); git_binary .command() - .args(&[ + .args([ OsStr::new("clone"), &qualified_origin, destination.as_os_str(), diff --git a/focus/tracing/src/git_trace2.rs b/focus/tracing/src/git_trace2.rs index 31c58919..26104b5f 100644 --- a/focus/tracing/src/git_trace2.rs +++ b/focus/tracing/src/git_trace2.rs @@ -235,7 +235,7 @@ impl Events { let mut result: Vec = Vec::new(); - let bytes = std::fs::read(&path)?; + let bytes = std::fs::read(path)?; debug!("parsing: {:?}", &path); for line in BufReader::new(bytes.as_slice()).lines() { let s = line?; @@ -664,7 +664,7 @@ mod tests { #[test] fn test_parse_examples() -> Result<()> { for (k, v) in data::DATA.iter() { - let xyz: serde_json::Result = serde_json::from_str(*v); + let xyz: serde_json::Result = serde_json::from_str(v); if let Err(e) = xyz { println!("failure: {}, {:?}", *k, e); bail!(e)