Patchwork D7678: rust-warnings: fix warnings in tests

login
register
mail settings
Submitter phabricator
Date Dec. 16, 2019, 10:28 a.m.
Message ID <differential-rev-PHID-DREV-egjnnviww4pvgcgnl3hg-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43864/
State Superseded
Headers show

Comments

phabricator - Dec. 16, 2019, 10:28 a.m.
Alphare created this revision.
Herald added subscribers: mercurial-devel, kevincox, durin42.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It turns out that I also missed those warnings inside tests. This should be the
  last of them. One day we will get rid of this interface anyway.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7678

AFFECTED FILES
  rust/hg-core/src/dirstate/dirs_multiset.rs
  rust/hg-core/src/dirstate/dirstate_map.rs

CHANGE DETAILS




To: Alphare, #hg-reviewers
Cc: durin42, kevincox, mercurial-devel

Patch

diff --git a/rust/hg-core/src/dirstate/dirstate_map.rs b/rust/hg-core/src/dirstate/dirstate_map.rs
--- a/rust/hg-core/src/dirstate/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate/dirstate_map.rs
@@ -381,7 +381,8 @@ 
                 mtime: 1337,
                 size: 1337,
             },
-        );
+        )
+        .unwrap();
 
         assert_eq!(1, map.len());
         assert_eq!(0, map.non_normal_set.len());
diff --git a/rust/hg-core/src/dirstate/dirs_multiset.rs b/rust/hg-core/src/dirstate/dirs_multiset.rs
--- a/rust/hg-core/src/dirstate/dirs_multiset.rs
+++ b/rust/hg-core/src/dirstate/dirs_multiset.rs
@@ -196,7 +196,7 @@ 
         let manifest: Vec<HgPathBuf> = vec![];
         let mut map = DirsMultiset::from_manifest(&manifest).unwrap();
         let path = HgPath::new(b"");
-        map.add_path(path);
+        map.add_path(path).unwrap();
 
         assert_eq!(1, map.len());
     }
@@ -206,36 +206,36 @@ 
         let manifest: Vec<HgPathBuf> = vec![];
         let mut map = DirsMultiset::from_manifest(&manifest).unwrap();
 
-        map.add_path(HgPath::new(b"a/"));
+        map.add_path(HgPath::new(b"a/")).unwrap();
         assert_eq!(1, *map.inner.get(HgPath::new(b"a")).unwrap());
         assert_eq!(1, *map.inner.get(HgPath::new(b"")).unwrap());
         assert_eq!(2, map.len());
 
         // Non directory should be ignored
-        map.add_path(HgPath::new(b"a"));
+        map.add_path(HgPath::new(b"a")).unwrap();
         assert_eq!(1, *map.inner.get(HgPath::new(b"a")).unwrap());
         assert_eq!(2, map.len());
 
         // Non directory will still add its base
-        map.add_path(HgPath::new(b"a/b"));
+        map.add_path(HgPath::new(b"a/b")).unwrap();
         assert_eq!(2, *map.inner.get(HgPath::new(b"a")).unwrap());
         assert_eq!(2, map.len());
 
         // Duplicate path works
-        map.add_path(HgPath::new(b"a/"));
+        map.add_path(HgPath::new(b"a/")).unwrap();
         assert_eq!(3, *map.inner.get(HgPath::new(b"a")).unwrap());
 
         // Nested dir adds to its base
-        map.add_path(HgPath::new(b"a/b/"));
+        map.add_path(HgPath::new(b"a/b/")).unwrap();
         assert_eq!(4, *map.inner.get(HgPath::new(b"a")).unwrap());
         assert_eq!(1, *map.inner.get(HgPath::new(b"a/b")).unwrap());
 
         // but not its base's base, because it already existed
-        map.add_path(HgPath::new(b"a/b/c/"));
+        map.add_path(HgPath::new(b"a/b/c/")).unwrap();
         assert_eq!(4, *map.inner.get(HgPath::new(b"a")).unwrap());
         assert_eq!(2, *map.inner.get(HgPath::new(b"a/b")).unwrap());
 
-        map.add_path(HgPath::new(b"a/c/"));
+        map.add_path(HgPath::new(b"a/c/")).unwrap();
         assert_eq!(1, *map.inner.get(HgPath::new(b"a/c")).unwrap());
 
         let expected = DirsMultiset {