[Request] [+ ] D9094: rust: clippy pass
Alphare (Raphaël Gomès)
phabricator at mercurial-scm.org
Mon Sep 28 12:24:23 UTC 2020
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
This removes some justified warnings and one hard error that, while technically
not a bug, was an ugly oversight on my part.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D9094
AFFECTED FILES
rust/hg-core/src/dirstate/dirstate_tree/iter.rs
rust/hg-core/src/dirstate/dirstate_tree/node.rs
CHANGE DETAILS
diff --git a/rust/hg-core/src/dirstate/dirstate_tree/node.rs b/rust/hg-core/src/dirstate/dirstate_tree/node.rs
--- a/rust/hg-core/src/dirstate/dirstate_tree/node.rs
+++ b/rust/hg-core/src/dirstate/dirstate_tree/node.rs
@@ -91,9 +91,9 @@
match &mut self.kind {
NodeKind::Directory(directory) => {
- return Node::insert_in_directory(
+ Node::insert_in_directory(
directory, new_entry, head, tail,
- );
+ )
}
NodeKind::File(_) => {
unreachable!("The file case has already been handled")
@@ -227,7 +227,7 @@
d.children.remove(head);
}
res.cleanup =
- d.children.len() == 0 && d.was_file.is_none();
+ d.children.is_empty() && d.was_file.is_none();
res
} else {
empty_result
@@ -241,7 +241,7 @@
if cleanup {
d.children.remove(head);
}
- if d.children.len() == 0 && d.was_file.is_none() {
+ if d.children.is_empty() && d.was_file.is_none() {
f.was_directory = None;
}
@@ -288,7 +288,7 @@
}
RemoveResult {
- cleanup: cleanup,
+ cleanup,
old_entry: Some(entry),
}
}
diff --git a/rust/hg-core/src/dirstate/dirstate_tree/iter.rs b/rust/hg-core/src/dirstate/dirstate_tree/iter.rs
--- a/rust/hg-core/src/dirstate/dirstate_tree/iter.rs
+++ b/rust/hg-core/src/dirstate/dirstate_tree/iter.rs
@@ -160,7 +160,7 @@
let meta = self.root_dir.join(filename_as_path).symlink_metadata();
match meta {
Ok(ref m) if m.file_type().is_symlink() => true,
- _ => return false,
+ _ => false,
}
}
}
@@ -182,7 +182,7 @@
fn next(&mut self) -> Option<Self::Item> {
// If any paths have already been `Dispatch`-ed, return them
- while let Some(res) = self.shortcuts.pop_front() {
+ if let Some(res) = self.shortcuts.pop_front() {
return Some(res);
}
@@ -250,7 +250,7 @@
) {
to_visit.extend(dir.children.iter().map(|(path, child)| {
let full_path = join_path(&base_path, &path);
- (Cow::from(full_path), child)
+ (full_path, child)
}));
}
To: Alphare, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200928/13a0be94/attachment-0001.html>
More information about the Mercurial-patches
mailing list