From ceb1ce4a5584f65caf1f97d1b694e5bb92d1b304 Mon Sep 17 00:00:00 2001 From: gwenn Date: Tue, 19 Mar 2019 20:45:04 +0100 Subject: [PATCH] Rustfmt --- src/cache.rs | 9 +++++---- src/lib.rs | 6 ++++-- src/session.rs | 2 +- src/types/url.rs | 14 +++++--------- src/vtab/csvtab.rs | 6 ++++-- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/cache.rs b/src/cache.rs index dfece9e..a6d1727 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -151,9 +151,9 @@ impl StatementCache { #[cfg(test)] mod test { - use fallible_iterator::FallibleIterator; use super::StatementCache; use crate::{Connection, NO_PARAMS}; + use fallible_iterator::FallibleIterator; impl StatementCache { fn clear(&self) { @@ -279,8 +279,7 @@ mod test { let mut stmt = db.prepare_cached(sql).unwrap(); assert_eq!( Ok(Some(1i32)), - stmt.query(NO_PARAMS).unwrap().map(|r| r.get(0)) - .next() + stmt.query(NO_PARAMS).unwrap().map(|r| r.get(0)).next() ); } @@ -296,7 +295,9 @@ mod test { let mut stmt = db.prepare_cached(sql).unwrap(); assert_eq!( Ok(Some((1i32, 2i32))), - stmt.query(NO_PARAMS).unwrap().map(|r| Ok((r.get(0)?, r.get(1)?))) + stmt.query(NO_PARAMS) + .unwrap() + .map(|r| Ok((r.get(0)?, r.get(1)?))) .next() ); } diff --git a/src/lib.rs b/src/lib.rs index 4e7d08a..3685349 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -846,10 +846,10 @@ unsafe fn db_filename(_: *mut ffi::sqlite3) -> Option { #[cfg(test)] mod test { - use fallible_iterator::FallibleIterator; use self::tempdir::TempDir; pub use super::*; use crate::ffi; + use fallible_iterator::FallibleIterator; pub use std::error::Error as StdError; pub use std::fmt; use tempdir; @@ -1133,7 +1133,9 @@ mod test { let mut query = db.prepare("SELECT x, y FROM foo ORDER BY x DESC").unwrap(); let results: Result> = query - .query(NO_PARAMS).unwrap().map(|row| row.get(1)) + .query(NO_PARAMS) + .unwrap() + .map(|row| row.get(1)) .collect(); assert_eq!(results.unwrap().concat(), "hello, world!"); diff --git a/src/session.rs b/src/session.rs index 2546520..ac6e9f9 100644 --- a/src/session.rs +++ b/src/session.rs @@ -719,8 +719,8 @@ unsafe extern "C" fn x_output(p_out: *mut c_void, data: *const c_void, len: c_in #[cfg(test)] mod test { - use std::sync::atomic::{AtomicBool, Ordering}; use fallible_streaming_iterator::FallibleStreamingIterator; + use std::sync::atomic::{AtomicBool, Ordering}; use super::{Changeset, ChangesetIter, ConflictAction, ConflictType, Session}; use crate::hooks::Action; diff --git a/src/types/url.rs b/src/types/url.rs index 3028a04..6d96028 100644 --- a/src/types/url.rs +++ b/src/types/url.rs @@ -1,7 +1,7 @@ //! `ToSql` and `FromSql` implementation for [`url::Url`]. -use url::Url; -use crate::Result; use crate::types::{FromSql, FromSqlError, FromSqlResult, ToSql, ToSqlOutput, ValueRef}; +use crate::Result; +use url::Url; /// Serialize `Url` to text. impl ToSql for Url { @@ -23,8 +23,8 @@ impl FromSql for Url { #[cfg(test)] mod test { - use url::{Url, ParseError}; - use crate::{Connection, params, Error, Result}; + use crate::{params, Connection, Error, Result}; + use url::{ParseError, Url}; fn checked_memory_handle() -> Connection { let db = Connection::open_in_memory().unwrap(); @@ -34,11 +34,7 @@ mod test { } fn get_url(db: &Connection, id: i64) -> Result { - db.query_row( - "SELECT v FROM urls WHERE i = ?", - params![id], - |r| r.get(0), - ) + db.query_row("SELECT v FROM urls WHERE i = ?", params![id], |r| r.get(0)) } #[test] diff --git a/src/vtab/csvtab.rs b/src/vtab/csvtab.rs index 7e52655..bf092b0 100644 --- a/src/vtab/csvtab.rs +++ b/src/vtab/csvtab.rs @@ -345,9 +345,9 @@ impl From for Error { #[cfg(test)] mod test { - use fallible_iterator::FallibleIterator; use crate::vtab::csvtab; use crate::{Connection, Result, NO_PARAMS}; + use fallible_iterator::FallibleIterator; #[test] fn test_csv_module() { @@ -364,7 +364,9 @@ mod test { } let ids: Result> = s - .query(NO_PARAMS).unwrap().map(|row| row.get::<_, i32>(0)) + .query(NO_PARAMS) + .unwrap() + .map(|row| row.get::<_, i32>(0)) .collect(); let sum = ids.unwrap().iter().sum::(); assert_eq!(sum, 15);