Work around a couple of false positives for recent nightly clippy

This is likely https://github.com/rust-lang/rust-clippy/issues/10577
This commit is contained in:
Ilya Grigoriev 2023-03-31 16:43:10 -07:00
parent 5a771c913b
commit a58af4f19d
2 changed files with 10 additions and 7 deletions

View file

@ -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()]);

View file

@ -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!(