From 0a46a34e3da767f296eaed60656611ca3ab29108 Mon Sep 17 00:00:00 2001 From: gwenn Date: Wed, 30 Jan 2019 20:14:46 +0100 Subject: [PATCH] Clean examples Remove `extern crate` usages. Rustfmt. --- src/blob.rs | 2 -- src/functions.rs | 3 --- src/lib.rs | 13 ++----------- src/statement.rs | 8 ++++---- src/types/mod.rs | 4 ---- 5 files changed, 6 insertions(+), 24 deletions(-) diff --git a/src/blob.rs b/src/blob.rs index 1cf3779..9692d60 100644 --- a/src/blob.rs +++ b/src/blob.rs @@ -14,8 +14,6 @@ //! ## Example //! //! ```rust -//! extern crate rusqlite; -//! //! use rusqlite::blob::ZeroBlob; //! use rusqlite::{Connection, DatabaseName, NO_PARAMS}; //! use std::io::{Read, Seek, SeekFrom, Write}; diff --git a/src/functions.rs b/src/functions.rs index 289a6f0..81372e1 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -9,9 +9,6 @@ //! module. //! //! ```rust -//! extern crate rusqlite; -//! extern crate regex; -//! //! use regex::Regex; //! use rusqlite::{Connection, Error, Result, NO_PARAMS}; //! use std::collections::HashMap; diff --git a/src/lib.rs b/src/lib.rs index 18658a4..ac61236 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,11 +2,8 @@ //! expose an interface similar to [rust-postgres](https://github.com/sfackler/rust-postgres). //! //! ```rust -//! extern crate rusqlite; -//! extern crate time; -//! //! use rusqlite::types::ToSql; -//! use rusqlite::{Connection, params}; +//! use rusqlite::{params, Connection}; //! use time::Timespec; //! //! #[derive(Debug)] @@ -146,7 +143,6 @@ const STATEMENT_CACHE_DEFAULT_CAPACITY: usize = 16; /// To be used when your statement has no [parameter](https://sqlite.org/lang_expr.html#varparam). pub const NO_PARAMS: &[&dyn ToSql] = &[]; - /// A macro making it more convenient to pass heterogeneous lists /// of parameters as a `&[&dyn ToSql]`. /// @@ -1715,12 +1711,7 @@ mod test { let mut insert_stmt = db.prepare("INSERT INTO foo(i, x) VALUES(?, ?)").unwrap(); for (i, v) in vals.iter().enumerate() { let i_to_insert = i as i64; - assert_eq!( - insert_stmt - .execute(params![i_to_insert, v]) - .unwrap(), - 1 - ); + assert_eq!(insert_stmt.execute(params![i_to_insert, v]).unwrap(), 1); } let mut query = db.prepare("SELECT i, x FROM foo").unwrap(); diff --git a/src/statement.rs b/src/statement.rs index 1048c30..439a9e9 100644 --- a/src/statement.rs +++ b/src/statement.rs @@ -112,8 +112,8 @@ impl<'conn> Statement<'conn> { /// } /// ``` /// - /// Note, the `named_params` macro is provided for syntactic convenience, and - /// so the above example could also be written as: + /// Note, the `named_params` macro is provided for syntactic convenience, + /// and so the above example could also be written as: /// /// ```rust,no_run /// # use rusqlite::{Connection, Result, named_params}; @@ -216,8 +216,8 @@ impl<'conn> Statement<'conn> { /// } /// ``` /// - /// Note, the `named_params!` macro is provided for syntactic convenience, and - /// so the above example could also be written as: + /// Note, the `named_params!` macro is provided for syntactic convenience, + /// and so the above example could also be written as: /// /// ```rust,no_run /// # use rusqlite::{Connection, Result, named_params}; diff --git a/src/types/mod.rs b/src/types/mod.rs index 6f5d78d..ceb16b8 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -19,9 +19,6 @@ //! store timespecs as `f64`s: //! //! ```rust -//! extern crate rusqlite; -//! extern crate time; -//! //! use rusqlite::types::{FromSql, FromSqlResult, ToSql, ToSqlOutput, ValueRef}; //! use rusqlite::Result; //! @@ -77,7 +74,6 @@ mod value_ref; /// ## Example /// /// ```rust,no_run -/// # extern crate rusqlite; /// # use rusqlite::{Connection, Result}; /// # use rusqlite::types::{Null}; /// fn main() {}