Skip to content

Commit

Permalink
Work around a couple of false positive for recent nightly clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyagr committed Apr 1, 2023
1 parent 0f108e2 commit 2631cf2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions lib/src/default_index_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()]);
Expand Down
14 changes: 7 additions & 7 deletions lib/src/repo_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down

0 comments on commit 2631cf2

Please sign in to comment.