diff --git a/libsqlite3-sys/build.rs b/libsqlite3-sys/build.rs index dee18af..7a04922 100644 --- a/libsqlite3-sys/build.rs +++ b/libsqlite3-sys/build.rs @@ -82,7 +82,7 @@ mod build_bundled { // There may be other platforms that don't support `isnan`, they should be // tested for here. if cfg!(target_env = "msvc") { - use self::cc::windows_registry::{find_vs_version, VsVers}; + use cc::windows_registry::{find_vs_version, VsVers}; let vs_has_nan = match find_vs_version() { Ok(ver) => ver != VsVers::Vs12, Err(_msg) => false, @@ -298,8 +298,8 @@ mod bindings { mod bindings { use bindgen; - use self::bindgen::callbacks::{IntKind, ParseCallbacks}; use super::HeaderLocation; + use bindgen::callbacks::{IntKind, ParseCallbacks}; use std::fs::OpenOptions; use std::io::Write; diff --git a/src/busy.rs b/src/busy.rs index b9bfc65..1165f3b 100644 --- a/src/busy.rs +++ b/src/busy.rs @@ -75,12 +75,11 @@ impl InnerConnection { #[cfg(test)] mod test { - use self::tempdir::TempDir; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::mpsc::sync_channel; use std::thread; use std::time::Duration; - use tempdir; + use tempdir::TempDir; use crate::{Connection, Error, ErrorCode, Result, TransactionBehavior, NO_PARAMS}; diff --git a/src/collation.rs b/src/collation.rs index 43ea660..00c1cd1 100644 --- a/src/collation.rs +++ b/src/collation.rs @@ -118,14 +118,14 @@ impl InnerConnection { } let callback: fn(&Connection, &str) -> Result<()> = mem::transmute(arg1); - if let Err(_) = catch_unwind(|| { + if catch_unwind(|| { let conn = Connection::from_handle(arg2).unwrap(); let collation_name = { let c_slice = CStr::from_ptr(arg3).to_bytes(); str::from_utf8_unchecked(c_slice) }; callback(&conn, collation_name) - }) { + }).is_err() { return; // FIXME How ? } } diff --git a/src/functions.rs b/src/functions.rs index 89aa9e4..e8bd1a6 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -682,9 +682,7 @@ where #[cfg(test)] mod test { - use regex; - - use self::regex::Regex; + use regex::Regex; use std::f64::EPSILON; use std::os::raw::c_double; diff --git a/src/lib.rs b/src/lib.rs index 31c483c..654a548 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -850,13 +850,12 @@ unsafe fn db_filename(_: *mut ffi::sqlite3) -> Option { #[cfg(test)] mod test { - use self::tempdir::TempDir; - pub use super::*; + use super::*; use crate::ffi; use fallible_iterator::FallibleIterator; - pub use std::error::Error as StdError; - pub use std::fmt; - use tempdir; + use std::error::Error as StdError; + use std::fmt; + use tempdir::TempDir; // this function is never called, but is still type checked; in // particular, calls with specific instantiations will require @@ -891,8 +890,8 @@ mod test { ) .expect("create temp db"); - let mut db1 = Connection::open(&path).unwrap(); - let mut db2 = Connection::open(&path).unwrap(); + let mut db1 = Connection::open_with_flags(&path, OpenFlags::SQLITE_OPEN_READ_WRITE).unwrap(); + let mut db2 = Connection::open_with_flags(&path, OpenFlags::SQLITE_OPEN_READ_ONLY).unwrap(); db1.busy_timeout(Duration::from_millis(0)).unwrap(); db2.busy_timeout(Duration::from_millis(0)).unwrap(); diff --git a/src/types/chrono.rs b/src/types/chrono.rs index 035f141..3cba1e9 100644 --- a/src/types/chrono.rs +++ b/src/types/chrono.rs @@ -1,9 +1,8 @@ //! Convert most of the [Time Strings](http://sqlite.org/lang_datefunc.html) to chrono types. -use chrono; use std::borrow::Cow; -use self::chrono::{DateTime, Local, NaiveDate, NaiveDateTime, NaiveTime, TimeZone, Utc}; +use chrono::{DateTime, Local, NaiveDate, NaiveDateTime, NaiveTime, TimeZone, Utc}; use crate::types::{FromSql, FromSqlError, FromSqlResult, ToSql, ToSqlOutput, ValueRef}; use crate::Result; @@ -129,10 +128,8 @@ impl FromSql for DateTime { #[cfg(test)] mod test { - use super::chrono::{ - DateTime, Duration, Local, NaiveDate, NaiveDateTime, NaiveTime, TimeZone, Utc, - }; use crate::{Connection, Result, NO_PARAMS}; + use chrono::{DateTime, Duration, Local, NaiveDate, NaiveDateTime, NaiveTime, TimeZone, Utc}; fn checked_memory_handle() -> Connection { let db = Connection::open_in_memory().unwrap(); diff --git a/src/types/serde_json.rs b/src/types/serde_json.rs index 7460b31..a221b67 100644 --- a/src/types/serde_json.rs +++ b/src/types/serde_json.rs @@ -1,7 +1,6 @@ //! `ToSql` and `FromSql` implementation for JSON `Value`. -use serde_json; -use self::serde_json::Value; +use serde_json::Value; use crate::types::{FromSql, FromSqlError, FromSqlResult, ToSql, ToSqlOutput, ValueRef}; use crate::Result; @@ -27,9 +26,9 @@ impl FromSql for Value { #[cfg(test)] mod test { - use super::serde_json; use crate::types::ToSql; use crate::{Connection, NO_PARAMS}; + use serde_json; fn checked_memory_handle() -> Connection { let db = Connection::open_in_memory().unwrap(); diff --git a/src/types/time.rs b/src/types/time.rs index ed45a89..62075c7 100644 --- a/src/types/time.rs +++ b/src/types/time.rs @@ -36,8 +36,8 @@ impl FromSql for time::Timespec { #[cfg(test)] mod test { - use super::time; use crate::{Connection, Result, NO_PARAMS}; + use time; fn checked_memory_handle() -> Connection { let db = Connection::open_in_memory().unwrap();