rust-warnings: fix warnings in tests
authorRaphaël Gomès <rgomes@octobus.net>
Mon, 16 Dec 2019 11:28:14 +0100
changeset 43890 d8a96cebf75d
parent 43889 458504a8cca1
child 43891 7eb6a2680ae6
rust-warnings: fix warnings in tests 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. Differential Revision: https://phab.mercurial-scm.org/D7678
rust/hg-core/src/dirstate/dirs_multiset.rs
rust/hg-core/src/dirstate/dirstate_map.rs
--- a/rust/hg-core/src/dirstate/dirs_multiset.rs	Mon Dec 16 12:41:06 2019 +0100
+++ b/rust/hg-core/src/dirstate/dirs_multiset.rs	Mon Dec 16 11:28:14 2019 +0100
@@ -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 {
--- a/rust/hg-core/src/dirstate/dirstate_map.rs	Mon Dec 16 12:41:06 2019 +0100
+++ b/rust/hg-core/src/dirstate/dirstate_map.rs	Mon Dec 16 11:28:14 2019 +0100
@@ -381,7 +381,8 @@
                 mtime: 1337,
                 size: 1337,
             },
-        );
+        )
+        .unwrap();
 
         assert_eq!(1, map.len());
         assert_eq!(0, map.non_normal_set.len());