diff --git a/lib/src/git_store.rs b/lib/src/git_store.rs index bd0be5969..3fba3648c 100644 --- a/lib/src/git_store.rs +++ b/lib/src/git_store.rs @@ -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"); diff --git a/lib/src/index.rs b/lib/src/index.rs index 0ef1e338a..93836016f 100644 --- a/lib/src/index.rs +++ b/lib/src/index.rs @@ -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::::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); diff --git a/lib/src/matchers.rs b/lib/src/matchers.rs index b14dd06b8..9ae4d9793 100644 --- a/lib/src/matchers.rs +++ b/lib/src/matchers.rs @@ -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 { diff --git a/lib/src/repo_path.rs b/lib/src/repo_path.rs index d6b332e85..d19e6fc25 100644 --- a/lib/src/repo_path.rs +++ b/lib/src/repo_path.rs @@ -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] diff --git a/lib/tests/test_commit_builder.rs b/lib/tests/test_commit_builder.rs index f6afbc301..fd52a480f 100644 --- a/lib/tests/test_commit_builder.rs +++ b/lib/tests/test_commit_builder.rs @@ -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!( diff --git a/lib/tests/test_merge_trees.rs b/lib/tests/test_merge_trees.rs index db4916f0c..a89fd5d82 100644 --- a/lib/tests/test_merge_trees.rs +++ b/lib/tests/test_merge_trees.rs @@ -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, diff --git a/lib/tests/test_working_copy.rs b/lib/tests/test_working_copy.rs index e73f31521..0c4c467aa 100644 --- a/lib/tests/test_working_copy.rs +++ b/lib/tests/test_working_copy.rs @@ -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); } }; } diff --git a/src/graphlog.rs b/src/graphlog.rs index 3f12e822d..499f3b483 100644 --- a/src/graphlog.rs +++ b/src/graphlog.rs @@ -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(()) }