From 81d61df9f7c8a2ede61aa528bced0707fdd80f4f Mon Sep 17 00:00:00 2001 From: William Brown Date: Fri, 22 Mar 2019 10:02:05 +1000 Subject: [PATCH] fmt --- src/lib/be/mod.rs | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/src/lib/be/mod.rs b/src/lib/be/mod.rs index 2047f399c..886d95a79 100644 --- a/src/lib/be/mod.rs +++ b/src/lib/be/mod.rs @@ -385,19 +385,19 @@ impl BackendWriteTransaction { }) } - pub fn backup(&self, audit: &mut AuditScope, dstPath: &str) -> Result<(), OperationError> { - + pub fn backup(&self, audit: &mut AuditScope, dstPath: &str) -> Result<(), OperationError> { //open connection to the destination - let result = self.conn.backup(rusqlite::DatabaseName::Main, dstPath, None); + let result = self + .conn + .backup(rusqlite::DatabaseName::Main, dstPath, None); match result { - Ok(_) => Ok(()), Err(e) => { audit_log!(audit, "Error in sqlite {:?}", e); Err(OperationError::SQLiteError) } - } + } } // Should this be offline only? @@ -760,31 +760,25 @@ mod tests { assert!(be.delete(audit, &vec![r2.clone(), r3.clone()]).is_ok()); }); } - + pub static dbBackupFileName: &'static str = "./.backup_test.db"; #[test] fn test_backup_restore() { - run_test!(|audit: &mut AuditScope, be: &BackendWriteTransaction| { - let result = fs::remove_file(dbBackupFileName); - - match result{ - - Err(e) => { - - // if the error is the file is not found, thats what we want so continue, - // otherwise return the error - match e.kind(){ - std::io::ErrorKind::NotFound => {}, - _ => (), + match result { + Err(e) => { + // if the error is the file is not found, thats what we want so continue, + // otherwise return the error + match e.kind() { + std::io::ErrorKind::NotFound => {} + _ => (), } - }, + } _ => (), - } - + } be.backup(audit, "./.backup_test.db").unwrap(); be.restore(audit).unwrap();