forked from mirrors/jj
cleanup: address warnings reported by new clippy version
This commit is contained in:
parent
ba4ac44719
commit
13134bd5a4
8 changed files with 38 additions and 58 deletions
|
@ -543,8 +543,8 @@ mod tests {
|
|||
assert_eq!(commit.parents, vec![]);
|
||||
assert_eq!(commit.predecessors, vec![]);
|
||||
assert_eq!(commit.root_tree.0.as_slice(), root_tree_id.as_bytes());
|
||||
assert_eq!(commit.is_open, false);
|
||||
assert_eq!(commit.is_pruned, false);
|
||||
assert!(!commit.is_open);
|
||||
assert!(!commit.is_pruned);
|
||||
assert_eq!(commit.description, "git commit message");
|
||||
assert_eq!(commit.author.name, "git author");
|
||||
assert_eq!(commit.author.email, "git.author@example.com");
|
||||
|
|
|
@ -1633,7 +1633,7 @@ mod tests {
|
|||
assert_eq!(entry.pos, 0);
|
||||
assert_eq!(entry.commit_id(), id_0);
|
||||
assert_eq!(entry.change_id(), change_id0);
|
||||
assert_eq!(entry.is_pruned(), false);
|
||||
assert!(!entry.is_pruned());
|
||||
assert_eq!(entry.generation_number(), 0);
|
||||
assert_eq!(entry.num_parents(), 0);
|
||||
assert_eq!(entry.parent_positions(), Vec::<u32>::new());
|
||||
|
@ -1761,7 +1761,7 @@ mod tests {
|
|||
assert_eq!(entry_1.pos, 1);
|
||||
assert_eq!(entry_1.commit_id(), id_1);
|
||||
assert_eq!(entry_1.change_id(), change_id1);
|
||||
assert_eq!(entry_1.is_pruned(), false);
|
||||
assert!(!entry_1.is_pruned());
|
||||
assert_eq!(entry_1.generation_number(), 1);
|
||||
assert_eq!(entry_1.num_parents(), 1);
|
||||
assert_eq!(entry_1.parent_positions(), vec![0]);
|
||||
|
@ -1772,14 +1772,14 @@ mod tests {
|
|||
assert_eq!(entry_2.pos, 2);
|
||||
assert_eq!(entry_2.commit_id(), id_2);
|
||||
assert_eq!(entry_2.change_id(), change_id2);
|
||||
assert_eq!(entry_2.is_pruned(), false);
|
||||
assert!(!entry_2.is_pruned());
|
||||
assert_eq!(entry_2.generation_number(), 1);
|
||||
assert_eq!(entry_2.num_parents(), 1);
|
||||
assert_eq!(entry_2.parent_positions(), vec![0]);
|
||||
assert_eq!(entry_3.change_id(), change_id3);
|
||||
assert_eq!(entry_3.generation_number(), 2);
|
||||
assert_eq!(entry_3.parent_positions(), vec![2]);
|
||||
assert_eq!(entry_3.is_pruned(), true);
|
||||
assert!(entry_3.is_pruned());
|
||||
assert_eq!(entry_4.pos, 4);
|
||||
assert_eq!(entry_4.generation_number(), 2);
|
||||
assert_eq!(entry_4.num_parents(), 1);
|
||||
|
|
|
@ -191,8 +191,8 @@ mod tests {
|
|||
#[test]
|
||||
fn filesmatcher_empty() {
|
||||
let m = FilesMatcher::new(HashSet::new());
|
||||
assert_eq!(m.matches(&FileRepoPath::from("file")), false);
|
||||
assert_eq!(m.matches(&FileRepoPath::from("dir/file")), false);
|
||||
assert!(!m.matches(&FileRepoPath::from("file")));
|
||||
assert!(!m.matches(&FileRepoPath::from("dir/file")));
|
||||
assert_eq!(
|
||||
m.visit(&DirRepoPath::root()),
|
||||
Visit {
|
||||
|
|
|
@ -346,12 +346,12 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn is_root() {
|
||||
assert_eq!(RepoPath::root().is_root(), true);
|
||||
assert_eq!(RepoPath::from("").is_root(), true);
|
||||
assert_eq!(RepoPath::from("foo").is_root(), false);
|
||||
assert_eq!(DirRepoPath::root().is_root(), true);
|
||||
assert_eq!(DirRepoPath::from("").is_root(), true);
|
||||
assert_eq!(DirRepoPath::from("foo/").is_root(), false);
|
||||
assert!(RepoPath::root().is_root());
|
||||
assert!(RepoPath::from("").is_root());
|
||||
assert!(!RepoPath::from("foo").is_root());
|
||||
assert!(DirRepoPath::root().is_root());
|
||||
assert!(DirRepoPath::from("").is_root());
|
||||
assert!(!DirRepoPath::from("foo/").is_root());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -375,35 +375,17 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn order() {
|
||||
assert_eq!(DirRepoPath::root() < DirRepoPath::from("dir/"), true);
|
||||
assert_eq!(DirRepoPath::from("dir/") < DirRepoPath::from("dirx/"), true);
|
||||
assert!(DirRepoPath::root() < DirRepoPath::from("dir/"));
|
||||
assert!(DirRepoPath::from("dir/") < DirRepoPath::from("dirx/"));
|
||||
// '#' < '/'
|
||||
assert_eq!(DirRepoPath::from("dir/") < DirRepoPath::from("dir#/"), true);
|
||||
assert_eq!(
|
||||
DirRepoPath::from("dir/") < DirRepoPath::from("dir/sub/"),
|
||||
true
|
||||
);
|
||||
assert!(DirRepoPath::from("dir/") < DirRepoPath::from("dir#/"));
|
||||
assert!(DirRepoPath::from("dir/") < DirRepoPath::from("dir/sub/"));
|
||||
|
||||
assert_eq!(
|
||||
FileRepoPath::from("abc") < FileRepoPath::from("dir/file"),
|
||||
true
|
||||
);
|
||||
assert_eq!(
|
||||
FileRepoPath::from("dir") < FileRepoPath::from("dir/file"),
|
||||
true
|
||||
);
|
||||
assert_eq!(
|
||||
FileRepoPath::from("dis") < FileRepoPath::from("dir/file"),
|
||||
true
|
||||
);
|
||||
assert_eq!(
|
||||
FileRepoPath::from("xyz") < FileRepoPath::from("dir/file"),
|
||||
true
|
||||
);
|
||||
assert_eq!(
|
||||
FileRepoPath::from("dir1/xyz") < FileRepoPath::from("dir2/abc"),
|
||||
true
|
||||
);
|
||||
assert!(FileRepoPath::from("abc") < FileRepoPath::from("dir/file"));
|
||||
assert!(FileRepoPath::from("dir") < FileRepoPath::from("dir/file"));
|
||||
assert!(FileRepoPath::from("dis") < FileRepoPath::from("dir/file"));
|
||||
assert!(FileRepoPath::from("xyz") < FileRepoPath::from("dir/file"));
|
||||
assert!(FileRepoPath::from("dir1/xyz") < FileRepoPath::from("dir2/abc"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -42,7 +42,7 @@ fn test_initial(use_git: bool) {
|
|||
|
||||
assert_eq!(commit.parents(), vec![store.root_commit()]);
|
||||
assert_eq!(commit.predecessors(), vec![]);
|
||||
assert_eq!(commit.is_open(), false);
|
||||
assert!(!commit.is_open());
|
||||
assert_eq!(commit.description(), "");
|
||||
assert_eq!(commit.author().name, settings.user_name());
|
||||
assert_eq!(commit.author().email, settings.user_email());
|
||||
|
@ -104,7 +104,7 @@ fn test_rewrite(use_git: bool) {
|
|||
rewritten_commit.predecessors(),
|
||||
vec![initial_commit.clone()]
|
||||
);
|
||||
assert_eq!(rewritten_commit.is_open(), false);
|
||||
assert!(!rewritten_commit.is_open());
|
||||
assert_eq!(rewritten_commit.author().name, settings.user_name());
|
||||
assert_eq!(rewritten_commit.author().email, settings.user_email());
|
||||
assert_eq!(
|
||||
|
|
|
@ -76,7 +76,7 @@ fn test_same_type(use_git: bool) {
|
|||
// Check that we have exactly the paths we expect in the merged tree
|
||||
let names: Vec<&str> = merged_tree
|
||||
.entries_non_recursive()
|
||||
.map(|entry| entry.name().as_ref())
|
||||
.map(|entry| entry.name())
|
||||
.collect();
|
||||
assert_eq!(
|
||||
names,
|
||||
|
|
|
@ -43,7 +43,7 @@ fn test_root(use_git: bool) {
|
|||
assert_eq!(wc_commit.store_commit().parents, vec![]);
|
||||
assert_eq!(wc_commit.predecessors(), vec![]);
|
||||
assert_eq!(wc_commit.description(), "");
|
||||
assert_eq!(wc_commit.is_open(), true);
|
||||
assert!(wc_commit.is_open());
|
||||
assert_eq!(wc_commit.author().name, settings.user_name());
|
||||
assert_eq!(wc_commit.author().email, settings.user_email());
|
||||
assert_eq!(wc_commit.committer().name, settings.user_name());
|
||||
|
@ -191,12 +191,12 @@ fn test_checkout_file_transitions(use_git: bool) {
|
|||
let maybe_metadata = wc_path.symlink_metadata();
|
||||
match right_kind {
|
||||
Kind::Missing => {
|
||||
assert_eq!(maybe_metadata.is_ok(), false, "{:?} should not exist", path);
|
||||
assert!(!maybe_metadata.is_ok(), "{:?} should not exist", path);
|
||||
}
|
||||
Kind::Normal => {
|
||||
assert_eq!(maybe_metadata.is_ok(), true, "{:?} should exist", path);
|
||||
assert!(maybe_metadata.is_ok(), "{:?} should exist", path);
|
||||
let metadata = maybe_metadata.unwrap();
|
||||
assert_eq!(metadata.is_file(), true, "{:?} should be a file", path);
|
||||
assert!(metadata.is_file(), "{:?} should be a file", path);
|
||||
#[cfg(unix)]
|
||||
assert_eq!(
|
||||
metadata.permissions().mode() & 0o111,
|
||||
|
@ -206,9 +206,9 @@ fn test_checkout_file_transitions(use_git: bool) {
|
|||
);
|
||||
}
|
||||
Kind::Executable => {
|
||||
assert_eq!(maybe_metadata.is_ok(), true, "{:?} should exist", path);
|
||||
assert!(maybe_metadata.is_ok(), "{:?} should exist", path);
|
||||
let metadata = maybe_metadata.unwrap();
|
||||
assert_eq!(metadata.is_file(), true, "{:?} should be a file", path);
|
||||
assert!(metadata.is_file(), "{:?} should be a file", path);
|
||||
#[cfg(unix)]
|
||||
assert_ne!(
|
||||
metadata.permissions().mode() & 0o111,
|
||||
|
@ -218,23 +218,22 @@ fn test_checkout_file_transitions(use_git: bool) {
|
|||
);
|
||||
}
|
||||
Kind::Symlink => {
|
||||
assert_eq!(maybe_metadata.is_ok(), true, "{:?} should exist", path);
|
||||
assert!(maybe_metadata.is_ok(), "{:?} should exist", path);
|
||||
let metadata = maybe_metadata.unwrap();
|
||||
assert_eq!(
|
||||
assert!(
|
||||
metadata.file_type().is_symlink(),
|
||||
true,
|
||||
"{:?} should be a symlink",
|
||||
path
|
||||
);
|
||||
}
|
||||
Kind::Tree => {
|
||||
assert_eq!(maybe_metadata.is_ok(), true, "{:?} should exist", path);
|
||||
assert!(maybe_metadata.is_ok(), "{:?} should exist", path);
|
||||
let metadata = maybe_metadata.unwrap();
|
||||
assert_eq!(metadata.is_dir(), true, "{:?} should be a directory", path);
|
||||
assert!(metadata.is_dir(), "{:?} should be a directory", path);
|
||||
}
|
||||
Kind::GitSubmodule => {
|
||||
// Not supported for now
|
||||
assert_eq!(maybe_metadata.is_ok(), false, "{:?} should not exist", path);
|
||||
assert!(!maybe_metadata.is_ok(), "{:?} should not exist", path);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -242,7 +242,6 @@ where
|
|||
for _ in self.edges.len() + 1..pad_to_index {
|
||||
self.writer.write_all(b" ")?;
|
||||
}
|
||||
self.maybe_write_pending_text()?;
|
||||
} else {
|
||||
// If we're merging more than one step to the left, we need two rows:
|
||||
// | |_|_|/
|
||||
|
@ -273,8 +272,8 @@ where
|
|||
for _ in self.edges.len()..pad_to_index {
|
||||
self.writer.write_all(b" ")?;
|
||||
}
|
||||
self.maybe_write_pending_text()?;
|
||||
}
|
||||
self.maybe_write_pending_text()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue