changeset 476:7131b39ef70e

Run rustfmt.
author Lewin Bormann <lbo@spheniscida.de>
date Wed, 10 Jul 2019 22:03:07 +0200
parents 7b90bc62f284
children 30c7871a4a9e
files src/cmp.rs
diffstat 1 files changed, 93 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/src/cmp.rs	Wed Jul 10 22:03:00 2019 +0200
+++ b/src/cmp.rs	Wed Jul 10 22:03:07 2019 +0200
@@ -184,59 +184,109 @@
 
     #[test]
     fn test_cmp_defaultcmp_shortest_sep() {
-        assert_eq!(DefaultCmp.find_shortest_sep("abcd".as_bytes(), "abcf".as_bytes()),
-                   "abce".as_bytes());
-        assert_eq!(DefaultCmp.find_shortest_sep("abc".as_bytes(), "acd".as_bytes()),
-                   "abd".as_bytes());
-        assert_eq!(DefaultCmp.find_shortest_sep("abcdefghi".as_bytes(), "abcffghi".as_bytes()),
-                   "abce".as_bytes());
-        assert_eq!(DefaultCmp.find_shortest_sep("a".as_bytes(), "a".as_bytes()),
-                   "a".as_bytes());
-        assert_eq!(DefaultCmp.find_shortest_sep("a".as_bytes(), "b".as_bytes()),
-                   "a\0".as_bytes());
-        assert_eq!(DefaultCmp.find_shortest_sep("abc".as_bytes(), "zzz".as_bytes()),
-                   "b".as_bytes());
-        assert_eq!(DefaultCmp.find_shortest_sep("yyy".as_bytes(), "z".as_bytes()),
-                   "yyz".as_bytes());
-        assert_eq!(DefaultCmp.find_shortest_sep("".as_bytes(), "".as_bytes()),
-                   "".as_bytes());
+        assert_eq!(
+            DefaultCmp.find_shortest_sep("abcd".as_bytes(), "abcf".as_bytes()),
+            "abce".as_bytes()
+        );
+        assert_eq!(
+            DefaultCmp.find_shortest_sep("abc".as_bytes(), "acd".as_bytes()),
+            "abd".as_bytes()
+        );
+        assert_eq!(
+            DefaultCmp.find_shortest_sep("abcdefghi".as_bytes(), "abcffghi".as_bytes()),
+            "abce".as_bytes()
+        );
+        assert_eq!(
+            DefaultCmp.find_shortest_sep("a".as_bytes(), "a".as_bytes()),
+            "a".as_bytes()
+        );
+        assert_eq!(
+            DefaultCmp.find_shortest_sep("a".as_bytes(), "b".as_bytes()),
+            "a\0".as_bytes()
+        );
+        assert_eq!(
+            DefaultCmp.find_shortest_sep("abc".as_bytes(), "zzz".as_bytes()),
+            "b".as_bytes()
+        );
+        assert_eq!(
+            DefaultCmp.find_shortest_sep("yyy".as_bytes(), "z".as_bytes()),
+            "yyz".as_bytes()
+        );
+        assert_eq!(
+            DefaultCmp.find_shortest_sep("".as_bytes(), "".as_bytes()),
+            "".as_bytes()
+        );
     }
 
     #[test]
     fn test_cmp_defaultcmp_short_succ() {
-        assert_eq!(DefaultCmp.find_short_succ("abcd".as_bytes()),
-                   "b".as_bytes());
-        assert_eq!(DefaultCmp.find_short_succ("zzzz".as_bytes()),
-                   "{".as_bytes());
+        assert_eq!(
+            DefaultCmp.find_short_succ("abcd".as_bytes()),
+            "b".as_bytes()
+        );
+        assert_eq!(
+            DefaultCmp.find_short_succ("zzzz".as_bytes()),
+            "{".as_bytes()
+        );
         assert_eq!(DefaultCmp.find_short_succ(&[]), &[0xff]);
-        assert_eq!(DefaultCmp.find_short_succ(&[0xff, 0xff, 0xff]),
-                   &[0xff, 0xff, 0xff, 0xff]);
+        assert_eq!(
+            DefaultCmp.find_short_succ(&[0xff, 0xff, 0xff]),
+            &[0xff, 0xff, 0xff, 0xff]
+        );
     }
 
     #[test]
     fn test_cmp_internalkeycmp_shortest_sep() {
         let cmp = InternalKeyCmp(Rc::new(Box::new(DefaultCmp)));
-        assert_eq!(cmp.find_shortest_sep(LookupKey::new("abcd".as_bytes(), 1).internal_key(),
-                                         LookupKey::new("abcf".as_bytes(), 2).internal_key()),
-                   LookupKey::new("abce".as_bytes(), 1).internal_key());
-        assert_eq!(cmp.find_shortest_sep(LookupKey::new("abcd".as_bytes(), 1).internal_key(),
-                                         LookupKey::new("abce".as_bytes(), 2).internal_key()),
-                   LookupKey::new("abcd\0".as_bytes(), 1).internal_key());
-        assert_eq!(cmp.find_shortest_sep(LookupKey::new("abc".as_bytes(), 1).internal_key(),
-                                         LookupKey::new("zzz".as_bytes(), 2).internal_key()),
-                   LookupKey::new("b".as_bytes(), types::MAX_SEQUENCE_NUMBER).internal_key());
-        assert_eq!(cmp.find_shortest_sep(LookupKey::new("abc".as_bytes(), 1).internal_key(),
-                                         LookupKey::new("acd".as_bytes(), 2).internal_key()),
-                   LookupKey::new("abd".as_bytes(), 1).internal_key());
-        assert_eq!(cmp.find_shortest_sep(LookupKey::new("abc".as_bytes(), 1).internal_key(),
-                                         LookupKey::new("abe".as_bytes(), 2).internal_key()),
-                   LookupKey::new("abd".as_bytes(), 1).internal_key());
-        assert_eq!(cmp.find_shortest_sep(LookupKey::new("".as_bytes(), 1).internal_key(),
-                                         LookupKey::new("".as_bytes(), 2).internal_key()),
-                   LookupKey::new("".as_bytes(), 1).internal_key());
-        assert_eq!(cmp.find_shortest_sep(LookupKey::new("abc".as_bytes(), 2).internal_key(),
-                                         LookupKey::new("abc".as_bytes(), 2).internal_key()),
-                   LookupKey::new("abc".as_bytes(), 2).internal_key());
+        assert_eq!(
+            cmp.find_shortest_sep(
+                LookupKey::new("abcd".as_bytes(), 1).internal_key(),
+                LookupKey::new("abcf".as_bytes(), 2).internal_key()
+            ),
+            LookupKey::new("abce".as_bytes(), 1).internal_key()
+        );
+        assert_eq!(
+            cmp.find_shortest_sep(
+                LookupKey::new("abcd".as_bytes(), 1).internal_key(),
+                LookupKey::new("abce".as_bytes(), 2).internal_key()
+            ),
+            LookupKey::new("abcd\0".as_bytes(), 1).internal_key()
+        );
+        assert_eq!(
+            cmp.find_shortest_sep(
+                LookupKey::new("abc".as_bytes(), 1).internal_key(),
+                LookupKey::new("zzz".as_bytes(), 2).internal_key()
+            ),
+            LookupKey::new("b".as_bytes(), types::MAX_SEQUENCE_NUMBER).internal_key()
+        );
+        assert_eq!(
+            cmp.find_shortest_sep(
+                LookupKey::new("abc".as_bytes(), 1).internal_key(),
+                LookupKey::new("acd".as_bytes(), 2).internal_key()
+            ),
+            LookupKey::new("abd".as_bytes(), 1).internal_key()
+        );
+        assert_eq!(
+            cmp.find_shortest_sep(
+                LookupKey::new("abc".as_bytes(), 1).internal_key(),
+                LookupKey::new("abe".as_bytes(), 2).internal_key()
+            ),
+            LookupKey::new("abd".as_bytes(), 1).internal_key()
+        );
+        assert_eq!(
+            cmp.find_shortest_sep(
+                LookupKey::new("".as_bytes(), 1).internal_key(),
+                LookupKey::new("".as_bytes(), 2).internal_key()
+            ),
+            LookupKey::new("".as_bytes(), 1).internal_key()
+        );
+        assert_eq!(
+            cmp.find_shortest_sep(
+                LookupKey::new("abc".as_bytes(), 2).internal_key(),
+                LookupKey::new("abc".as_bytes(), 2).internal_key()
+            ),
+            LookupKey::new("abc".as_bytes(), 2).internal_key()
+        );
     }
 
     #[test]