From b10c52f32f4d4b161f9f80ef83fa7a0a217b28cb Mon Sep 17 00:00:00 2001 From: gwenn Date: Mon, 8 Aug 2016 15:23:55 +0200 Subject: [PATCH 1/2] Fix clippy warnings --- src/error.rs | 2 +- src/lib.rs | 2 ++ src/transaction.rs | 1 - src/types/mod.rs | 2 -- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/error.rs b/src/error.rs index a8794bf..efb5b24 100644 --- a/src/error.rs +++ b/src/error.rs @@ -11,6 +11,7 @@ pub type SqliteError = Error; /// Enum listing possible errors from rusqlite. #[derive(Debug)] +#[allow(enum_variant_names)] pub enum Error { /// An error from an underlying SQLite call. SqliteFailure(ffi::Error, Option), @@ -140,7 +141,6 @@ impl error::Error for Error { } } - #[cfg_attr(feature="clippy", allow(match_same_arms))] fn cause(&self) -> Option<&error::Error> { match *self { Error::SqliteFailure(ref err, _) => Some(err), diff --git a/src/lib.rs b/src/lib.rs index 50cf7e9..1b64eff 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -50,6 +50,7 @@ //! } //! } //! ``` +#![allow(unknown_lints)] extern crate libc; extern crate libsqlite3_sys as ffi; @@ -975,6 +976,7 @@ pub struct Rows<'stmt> { stmt: Option<&'stmt Statement<'stmt>>, } +#[allow(should_implement_trait)] impl<'stmt> Rows<'stmt> { fn new(stmt: &'stmt Statement<'stmt>) -> Rows<'stmt> { Rows { stmt: Some(stmt) } diff --git a/src/transaction.rs b/src/transaction.rs index 347f5cb..d234956 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -401,7 +401,6 @@ impl Connection { } #[cfg(test)] -#[cfg_attr(feature="clippy", allow(similar_names))] mod test { use Connection; use super::DropBehavior; diff --git a/src/types/mod.rs b/src/types/mod.rs index 61deaf6..02d2a59 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -103,7 +103,6 @@ pub enum Value { } #[cfg(test)] -#[cfg_attr(feature="clippy", allow(similar_names))] mod test { extern crate time; @@ -182,7 +181,6 @@ mod test { } #[test] - #[cfg_attr(feature="clippy", allow(cyclomatic_complexity))] fn test_mismatched_types() { fn is_invalid_column_type(err: Error) -> bool { match err { From 8f28ff17b8230cb3371d5ff902bb05fe0eede1b1 Mon Sep 17 00:00:00 2001 From: gwenn Date: Mon, 15 Aug 2016 12:41:15 +0200 Subject: [PATCH 2/2] Fix rustdoc warnings --- README.md | 2 +- src/backup.rs | 2 +- src/functions.rs | 3 +-- src/lib.rs | 2 +- src/named_params.rs | 2 +- src/transaction.rs | 18 +++++++++--------- 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 2f8d23c..757bfd3 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ fn main() { &[&me.name, &me.time_created, &me.data]).unwrap(); let mut stmt = conn.prepare("SELECT id, name, time_created, data FROM person").unwrap(); - let mut person_iter = stmt.query_map(&[], |row| { + let person_iter = stmt.query_map(&[], |row| { Person { id: row.get(0), name: row.get(1), diff --git a/src/backup.rs b/src/backup.rs index 484171f..77ba0f6 100644 --- a/src/backup.rs +++ b/src/backup.rs @@ -18,7 +18,7 @@ //! # use std::path::Path; //! # use std::time; //! -//! fn backupDb>(src: &Connection, dst: P, progress: fn(backup::Progress)) +//! fn backup_db>(src: &Connection, dst: P, progress: fn(backup::Progress)) //! -> Result<()> { //! let mut dst = try!(Connection::open(dst)); //! let backup = try!(backup::Backup::new(src, &mut dst)); diff --git a/src/functions.rs b/src/functions.rs index 32e4d1e..bce3309 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -293,10 +293,9 @@ impl Connection { /// /// ```rust /// # use rusqlite::{Connection, Result}; - /// # type c_double = f64; /// fn scalar_function_example(db: Connection) -> Result<()> { /// try!(db.create_scalar_function("halve", 1, true, |ctx| { - /// let value = try!(ctx.get::(0)); + /// let value = try!(ctx.get::(0)); /// Ok(value / 2f64) /// })); /// diff --git a/src/lib.rs b/src/lib.rs index 1b64eff..792fcfb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -36,7 +36,7 @@ //! &[&me.name, &me.time_created, &me.data]).unwrap(); //! //! let mut stmt = conn.prepare("SELECT id, name, time_created, data FROM person").unwrap(); -//! let mut person_iter = stmt.query_map(&[], |row| { +//! let person_iter = stmt.query_map(&[], |row| { //! Person { //! id: row.get(0), //! name: row.get(1), diff --git a/src/named_params.rs b/src/named_params.rs index 5486074..9207adf 100644 --- a/src/named_params.rs +++ b/src/named_params.rs @@ -94,7 +94,7 @@ impl<'conn> Statement<'conn> { /// ## Example /// /// ```rust,no_run - /// # use rusqlite::{Connection, Result, Rows}; + /// # use rusqlite::{Connection, Result}; /// fn query(conn: &Connection) -> Result<()> { /// let mut stmt = try!(conn.prepare("SELECT * FROM test where name = :name")); /// let mut rows = try!(stmt.query_named(&[(":name", &"one")])); diff --git a/src/transaction.rs b/src/transaction.rs index d234956..6243994 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -44,8 +44,8 @@ pub type SqliteTransaction<'conn> = Transaction<'conn>; /// /// ```rust,no_run /// # use rusqlite::{Connection, Result}; -/// # fn do_queries_part_1(conn: &Connection) -> Result<()> { Ok(()) } -/// # fn do_queries_part_2(conn: &Connection) -> Result<()> { Ok(()) } +/// # fn do_queries_part_1(_conn: &Connection) -> Result<()> { Ok(()) } +/// # fn do_queries_part_2(_conn: &Connection) -> Result<()> { Ok(()) } /// fn perform_queries(conn: &mut Connection) -> Result<()> { /// let tx = try!(conn.transaction()); /// @@ -73,8 +73,8 @@ pub struct Transaction<'conn> { /// /// ```rust,no_run /// # use rusqlite::{Connection, Result}; -/// # fn do_queries_part_1(conn: &Connection) -> Result<()> { Ok(()) } -/// # fn do_queries_part_2(conn: &Connection) -> Result<()> { Ok(()) } +/// # fn do_queries_part_1(_conn: &Connection) -> Result<()> { Ok(()) } +/// # fn do_queries_part_2(_conn: &Connection) -> Result<()> { Ok(()) } /// fn perform_queries(conn: &mut Connection) -> Result<()> { /// let sp = try!(conn.savepoint()); /// @@ -120,7 +120,7 @@ impl<'conn> Transaction<'conn> { /// /// ```rust,no_run /// # use rusqlite::{Connection, Result}; - /// # fn perform_queries_part_1_succeeds(conn: &Connection) -> bool { true } + /// # fn perform_queries_part_1_succeeds(_conn: &Connection) -> bool { true } /// fn perform_queries(conn: &mut Connection) -> Result<()> { /// let mut tx = try!(conn.transaction()); /// @@ -328,8 +328,8 @@ impl Connection { /// /// ```rust,no_run /// # use rusqlite::{Connection, Result}; - /// # fn do_queries_part_1(conn: &Connection) -> Result<()> { Ok(()) } - /// # fn do_queries_part_2(conn: &Connection) -> Result<()> { Ok(()) } + /// # fn do_queries_part_1(_conn: &Connection) -> Result<()> { Ok(()) } + /// # fn do_queries_part_2(_conn: &Connection) -> Result<()> { Ok(()) } /// fn perform_queries(conn: &mut Connection) -> Result<()> { /// let tx = try!(conn.transaction()); /// @@ -369,8 +369,8 @@ impl Connection { /// /// ```rust,no_run /// # use rusqlite::{Connection, Result}; - /// # fn do_queries_part_1(conn: &Connection) -> Result<()> { Ok(()) } - /// # fn do_queries_part_2(conn: &Connection) -> Result<()> { Ok(()) } + /// # fn do_queries_part_1(_conn: &Connection) -> Result<()> { Ok(()) } + /// # fn do_queries_part_2(_conn: &Connection) -> Result<()> { Ok(()) } /// fn perform_queries(conn: &mut Connection) -> Result<()> { /// let sp = try!(conn.savepoint()); ///