From 54cf68d3d07ae2b3e42c1a7785ad87d076737dcd Mon Sep 17 00:00:00 2001 From: Martin Ek Date: Sun, 10 Feb 2019 17:35:27 +0000 Subject: [PATCH] rustfmt --- src/db.rs | 40 +++++++++++++++++++++++++++++++--------- tests/test_property.rs | 10 ++-------- 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/db.rs b/src/db.rs index 09edb42..bbccf8f 100644 --- a/src/db.rs +++ b/src/db.rs @@ -1161,7 +1161,10 @@ impl DB { let prop_name = match CString::new(name) { Ok(c) => c, Err(e) => { - return Err(Error::new(format!("Failed to convert property name to CString: {}", e))) + return Err(Error::new(format!( + "Failed to convert property name to CString: {}", + e + ))); } }; @@ -1174,7 +1177,10 @@ impl DB { let str_value = match CStr::from_ptr(value).to_str() { Ok(s) => s.to_owned(), Err(e) => { - return Err(Error::new(format!("Failed to convert property value to string: {}", e))) + return Err(Error::new(format!( + "Failed to convert property value to string: {}", + e + ))); } }; @@ -1191,7 +1197,10 @@ impl DB { let prop_name = match CString::new(name) { Ok(c) => c, Err(e) => { - return Err(Error::new(format!("Failed to convert property name to CString: {}", e))) + return Err(Error::new(format!( + "Failed to convert property name to CString: {}", + e + ))); } }; @@ -1204,7 +1213,10 @@ impl DB { let str_value = match CStr::from_ptr(value).to_str() { Ok(s) => s.to_owned(), Err(e) => { - return Err(Error::new(format!("Failed to convert property value to string: {}", e))) + return Err(Error::new(format!( + "Failed to convert property value to string: {}", + e + ))); } }; @@ -1221,8 +1233,11 @@ impl DB { match self.property_value(name) { Ok(Some(value)) => match value.parse::() { Ok(int_value) => Ok(Some(int_value)), - Err(e) => Err(Error::new(format!("Failed to convert property value to int: {}", e))), - } + Err(e) => Err(Error::new(format!( + "Failed to convert property value to int: {}", + e + ))), + }, Ok(None) => Ok(None), Err(e) => Err(e), } @@ -1232,12 +1247,19 @@ impl DB { /// /// For a full list of properties that return int values, see /// https://github.com/facebook/rocksdb/blob/08809f5e6cd9cc4bc3958dd4d59457ae78c76660/include/rocksdb/db.h#L654-L689 - pub fn property_int_value_cf(&self, cf: ColumnFamily, name: &str) -> Result, Error> { + pub fn property_int_value_cf( + &self, + cf: ColumnFamily, + name: &str, + ) -> Result, Error> { match self.property_value_cf(cf, name) { Ok(Some(value)) => match value.parse::() { Ok(int_value) => Ok(Some(int_value)), - Err(e) => Err(Error::new(format!("Failed to convert property value to int: {}", e))), - } + Err(e) => Err(Error::new(format!( + "Failed to convert property value to int: {}", + e + ))), + }, Ok(None) => Ok(None), Err(e) => Err(e), } diff --git a/tests/test_property.rs b/tests/test_property.rs index 11e1f21..6b30e59 100644 --- a/tests/test_property.rs +++ b/tests/test_property.rs @@ -23,10 +23,7 @@ fn property_test() { let n = DBPath::new("_rust_rocksdb_property_test"); { let db = DB::open_default(&n).unwrap(); - let value = db - .property_value("rocksdb.stats") - .unwrap() - .unwrap(); + let value = db.property_value("rocksdb.stats").unwrap().unwrap(); assert!(value.contains("Stats")); } @@ -39,10 +36,7 @@ fn property_cf_test() { let opts = Options::default(); let db = DB::open_default(&n).unwrap(); let cf = db.create_cf("cf1", &opts).unwrap(); - let value = db - .property_value_cf(cf, "rocksdb.stats") - .unwrap() - .unwrap(); + let value = db.property_value_cf(cf, "rocksdb.stats").unwrap().unwrap(); assert!(value.contains("Stats")); }