cleanup: fix some things reported by clippy 1.63

This commit is contained in:
Martin von Zweigbergk 2022-08-09 21:05:38 -07:00 committed by Martin von Zweigbergk
parent 5f0cb71177
commit 21f5bf8b15
6 changed files with 9 additions and 14 deletions

View file

@ -179,7 +179,7 @@ pub fn materialize_conflict(
}
let min_diff_index = diffs
.iter()
.position_min_by_key(|diff| diff_size(*diff))
.position_min_by_key(|diff| diff_size(diff))
.unwrap();
output.write_all(CONFLICT_MINUS_LINE)?;
output.write_all(CONFLICT_PLUS_LINE)?;

View file

@ -992,12 +992,7 @@ impl<'revset, 'repo> Iterator for FilterRevsetIterator<'revset, 'repo> {
type Item = IndexEntry<'repo>;
fn next(&mut self) -> Option<Self::Item> {
for entry in &mut self.iter {
if (self.predicate)(&entry) {
return Some(entry);
}
}
None
self.iter.find(self.predicate)
}
}

View file

@ -836,7 +836,7 @@ impl TreeState {
panic!("unexpected tree entry in diff at {:?}", path);
}
};
self.file_states.insert(path.clone(), file_state);
self.file_states.insert(path, file_state);
stats.added_files += 1;
}
Diff::Modified(
@ -875,7 +875,7 @@ impl TreeState {
}
};
self.file_states.insert(path.clone(), file_state);
self.file_states.insert(path, file_state);
stats.updated_files += 1;
}
}

View file

@ -27,13 +27,13 @@ use crate::repo::{ReadonlyRepo, RepoLoader};
use crate::settings::UserSettings;
use crate::working_copy::WorkingCopy;
#[derive(Error, Debug, PartialEq)]
#[derive(Error, Debug, PartialEq, Eq)]
pub enum WorkspaceInitError {
#[error("The destination repo ({0}) already exists")]
DestinationExists(PathBuf),
}
#[derive(Error, Debug, PartialEq)]
#[derive(Error, Debug, PartialEq, Eq)]
pub enum WorkspaceLoadError {
#[error("The repo appears to no longer be at {0}")]
RepoDoesNotExist(PathBuf),

View file

@ -59,7 +59,7 @@ fn test_same_type(use_git: bool) {
if contents != "_" {
testutils::write_normal_file(
&mut tree_builder,
&RepoPath::from_internal_string(*path),
&RepoPath::from_internal_string(path),
contents,
);
}

View file

@ -536,10 +536,10 @@ impl WorkspaceCommandHelper {
))),
Some(commit) => {
if iter.next().is_some() {
return Err(CommandError::UserError(format!(
Err(CommandError::UserError(format!(
"Revset \"{}\" resolved to more than one revision",
revision_str
)));
)))
} else {
Ok(commit?)
}