From a58af4f19d0de760e5fdfe3466ff2a90b8f6043d Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Fri, 31 Mar 2023 16:43:10 -0700 Subject: [PATCH] Work around a couple of false positives for recent nightly clippy This is likely https://github.com/rust-lang/rust-clippy/issues/10577 --- lib/src/default_index_store.rs | 3 +++ lib/src/repo_path.rs | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/src/default_index_store.rs b/lib/src/default_index_store.rs index e8195546a..090111ca0 100644 --- a/lib/src/default_index_store.rs +++ b/lib/src/default_index_store.rs @@ -1943,6 +1943,9 @@ mod tests { let id_1 = CommitId::from_hex("111111"); let change_id1 = new_change_id(); let id_2 = CommitId::from_hex("222222"); + #[allow(clippy::redundant_clone)] // Work around nightly clippy false positive + // TODO: Remove the exception after https://github.com/rust-lang/rust-clippy/issues/10577 + // is fixed or file a new bug. let change_id2 = change_id1.clone(); index.add_commit_data(id_0.clone(), change_id0, &[]); index.add_commit_data(id_1.clone(), change_id1.clone(), &[id_0.clone()]); diff --git a/lib/src/repo_path.rs b/lib/src/repo_path.rs index 1b92a63a6..b4358ea8e 100644 --- a/lib/src/repo_path.rs +++ b/lib/src/repo_path.rs @@ -317,35 +317,35 @@ mod tests { fn parse_fs_path_wc_in_cwd() { let temp_dir = testutils::new_temp_dir(); let cwd_path = temp_dir.path().join("repo"); - let wc_path = cwd_path.clone(); + let wc_path = &cwd_path; assert_eq!( - RepoPath::parse_fs_path(&cwd_path, &wc_path, ""), + RepoPath::parse_fs_path(&cwd_path, wc_path, ""), Ok(RepoPath::root()) ); assert_eq!( - RepoPath::parse_fs_path(&cwd_path, &wc_path, "."), + RepoPath::parse_fs_path(&cwd_path, wc_path, "."), Ok(RepoPath::root()) ); assert_eq!( - RepoPath::parse_fs_path(&cwd_path, &wc_path, "file"), + RepoPath::parse_fs_path(&cwd_path, wc_path, "file"), Ok(RepoPath::from_internal_string("file")) ); // Both slash and the platform's separator are allowed assert_eq!( RepoPath::parse_fs_path( &cwd_path, - &wc_path, + wc_path, &format!("dir{}file", std::path::MAIN_SEPARATOR) ), Ok(RepoPath::from_internal_string("dir/file")) ); assert_eq!( - RepoPath::parse_fs_path(&cwd_path, &wc_path, "dir/file"), + RepoPath::parse_fs_path(&cwd_path, wc_path, "dir/file"), Ok(RepoPath::from_internal_string("dir/file")) ); assert_eq!( - RepoPath::parse_fs_path(&cwd_path, &wc_path, ".."), + RepoPath::parse_fs_path(&cwd_path, wc_path, ".."), Err(FsPathParseError::InputNotInRepo("..".to_string())) ); assert_eq!(