From 1262238229719fe24d02b6e127e52879b9e6698e Mon Sep 17 00:00:00 2001 From: gwenn Date: Tue, 30 Oct 2018 20:13:41 +0100 Subject: [PATCH] Rustfmt --- src/backup.rs | 9 ++------- src/blob.rs | 2 +- src/cache.rs | 4 ++-- src/error.rs | 4 ++-- src/hooks.rs | 2 +- src/lib.rs | 4 +--- src/transaction.rs | 2 +- src/types/mod.rs | 2 +- src/types/to_sql.rs | 4 ++-- src/unlock_notify.rs | 2 +- src/vtab/array.rs | 2 +- 11 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/backup.rs b/src/backup.rs index 40e2e7c..250e0c8 100644 --- a/src/backup.rs +++ b/src/backup.rs @@ -63,12 +63,7 @@ impl Connection { ) -> Result<()> { use self::StepResult::{Busy, Done, Locked, More}; let mut dst = Connection::open(dst_path)?; - let backup = Backup::new_with_names( - self, - name, - &mut dst, - DatabaseName::Main - )?; + let backup = Backup::new_with_names(self, name, &mut dst, DatabaseName::Main)?; let mut r = More; while r == More { @@ -308,8 +303,8 @@ impl<'a, 'b> Drop for Backup<'a, 'b> { #[cfg(test)] mod test { use super::Backup; - use std::time::Duration; use crate::{Connection, DatabaseName, NO_PARAMS}; + use std::time::Duration; #[test] fn test_backup() { diff --git a/src/blob.rs b/src/blob.rs index e2263bf..0b41a5f 100644 --- a/src/blob.rs +++ b/src/blob.rs @@ -262,8 +262,8 @@ impl ToSql for ZeroBlob { #[cfg(test)] mod test { - use std::io::{BufRead, BufReader, BufWriter, Read, Seek, SeekFrom, Write}; use crate::{Connection, DatabaseName, Result}; + use std::io::{BufRead, BufReader, BufWriter, Read, Seek, SeekFrom, Write}; fn db_with_test_blob() -> Result<(Connection, i64)> { let db = Connection::open_in_memory()?; diff --git a/src/cache.rs b/src/cache.rs index 6d56c31..8dc3912 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -1,10 +1,10 @@ //! Prepared statements cache for faster execution. -use lru_cache::LruCache; use crate::raw_statement::RawStatement; +use crate::{Connection, Result, Statement}; +use lru_cache::LruCache; use std::cell::RefCell; use std::ops::{Deref, DerefMut}; -use crate::{Connection, Result, Statement}; impl Connection { /// Prepare a SQL statement for execution, returning a previously prepared diff --git a/src/error.rs b/src/error.rs index 0b36443..f11958d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,10 +1,10 @@ +use crate::types::Type; +use crate::{errmsg_to_string, ffi}; use std::error; use std::fmt; use std::os::raw::c_int; use std::path::PathBuf; use std::str; -use crate::types::Type; -use crate::{errmsg_to_string, ffi}; /// Old name for `Error`. `SqliteError` is deprecated. #[deprecated(since = "0.6.0", note = "Use Error instead")] diff --git a/src/hooks.rs b/src/hooks.rs index 8478b79..947e7f4 100644 --- a/src/hooks.rs +++ b/src/hooks.rs @@ -289,8 +289,8 @@ fn free_boxed_hook(p: *mut c_void) { #[cfg(test)] mod test { use super::Action; - use std::sync::atomic::{AtomicBool, Ordering}; use crate::Connection; + use std::sync::atomic::{AtomicBool, Ordering}; #[test] fn test_commit_hook() { diff --git a/src/lib.rs b/src/lib.rs index c2ef16a..b5b3d68 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1577,9 +1577,7 @@ mod test { for (i, v) in vals.iter().enumerate() { let i_to_insert = i as i64; assert_eq!( - insert_stmt - .execute(&[&i_to_insert as &ToSql, &v]) - .unwrap(), + insert_stmt.execute(&[&i_to_insert as &ToSql, &v]).unwrap(), 1 ); } diff --git a/src/transaction.rs b/src/transaction.rs index a294c22..17bb279 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -1,5 +1,5 @@ -use std::ops::Deref; use crate::{Connection, Result}; +use std::ops::Deref; /// Old name for `TransactionBehavior`. `SqliteTransactionBehavior` is /// deprecated. diff --git a/src/types/mod.rs b/src/types/mod.rs index e39240c..0d19dc1 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -114,9 +114,9 @@ mod test { extern crate time; use super::Value; + use crate::{Connection, Error, NO_PARAMS}; use std::f64::EPSILON; use std::os::raw::{c_double, c_int}; - use crate::{Connection, Error, NO_PARAMS}; fn checked_memory_handle() -> Connection { let db = Connection::open_in_memory().unwrap(); diff --git a/src/types/to_sql.rs b/src/types/to_sql.rs index 651107b..81df0d9 100644 --- a/src/types/to_sql.rs +++ b/src/types/to_sql.rs @@ -1,8 +1,8 @@ use super::{Null, Value, ValueRef}; -use std::borrow::Cow; #[cfg(feature = "array")] use crate::vtab::array::Array; use crate::Result; +use std::borrow::Cow; /// `ToSqlOutput` represents the possible output types for implementors of the /// `ToSql` trait. @@ -207,8 +207,8 @@ mod test { #[cfg(feature = "i128_blob")] #[test] fn test_i128() { - use std::i128; use crate::{Connection, NO_PARAMS}; + use std::i128; let db = Connection::open_in_memory().unwrap(); db.execute_batch("CREATE TABLE foo (i128 BLOB, desc TEXT)") .unwrap(); diff --git a/src/unlock_notify.rs b/src/unlock_notify.rs index 785f05e..0f8f6fa 100644 --- a/src/unlock_notify.rs +++ b/src/unlock_notify.rs @@ -99,10 +99,10 @@ pub fn wait_for_unlock_notify(_db: *mut ffi::sqlite3) -> c_int { #[cfg(feature = "unlock_notify")] #[cfg(test)] mod test { + use crate::{Connection, OpenFlags, Result, Transaction, TransactionBehavior, NO_PARAMS}; use std::sync::mpsc::sync_channel; use std::thread; use std::time; - use crate::{Connection, OpenFlags, Result, Transaction, TransactionBehavior, NO_PARAMS}; #[test] fn test_unlock_notify() { diff --git a/src/vtab/array.rs b/src/vtab/array.rs index 496a8f8..672e34d 100644 --- a/src/vtab/array.rs +++ b/src/vtab/array.rs @@ -169,10 +169,10 @@ impl VTabCursor for ArrayTabCursor { #[cfg(test)] mod test { - use std::rc::Rc; use crate::types::Value; use crate::vtab::array; use crate::Connection; + use std::rc::Rc; #[test] fn test_array_module() {