From 495f1d529a5bb46332e4343f8773e4e1eaeaaf49 Mon Sep 17 00:00:00 2001 From: gwenn Date: Thu, 1 Nov 2018 09:40:56 +0100 Subject: [PATCH 1/2] Clippy --- benches/lib.rs | 1 + src/error.rs | 2 +- src/lib.rs | 2 +- src/row.rs | 2 +- src/statement.rs | 7 +------ src/vtab/mod.rs | 4 +++- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/benches/lib.rs b/benches/lib.rs index fb03d09..421e0ec 100644 --- a/benches/lib.rs +++ b/benches/lib.rs @@ -1,3 +1,4 @@ +#![feature(extern_crate_item_prelude)] #![feature(test)] extern crate test; diff --git a/src/error.rs b/src/error.rs index 27674f8..ac4fc27 100644 --- a/src/error.rs +++ b/src/error.rs @@ -12,7 +12,7 @@ pub type SqliteError = Error; /// Enum listing possible errors from rusqlite. #[derive(Debug)] -#[allow(enum_variant_names)] +#[allow(clippy::enum_variant_names)] pub enum Error { /// An error from an underlying SQLite call. SqliteFailure(ffi::Error, Option), diff --git a/src/lib.rs b/src/lib.rs index 3448f87..856a2a3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -147,7 +147,7 @@ pub mod vtab; // Number of cached prepared statements we'll hold on to. 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: &'static [&'static ToSql] = &[]; +pub const NO_PARAMS: &[&ToSql] = &[]; /// Old name for `Result`. `SqliteResult` is deprecated. #[deprecated(since = "0.6.0", note = "Use Result instead")] diff --git a/src/row.rs b/src/row.rs index 095eaee..2c4b761 100644 --- a/src/row.rs +++ b/src/row.rs @@ -27,7 +27,7 @@ impl<'stmt> Rows<'stmt> { /// This is a "streaming iterator". For a more natural interface, /// consider using `query_map` or `query_and_then` instead, which /// return types that implement `Iterator`. - #[cfg_attr(feature = "cargo-clippy", allow(should_implement_trait))] // cannot implement Iterator + #[cfg_attr(feature = "cargo-clippy", allow(clippy::should_implement_trait))] // cannot implement Iterator pub fn next<'a>(&'a mut self) -> Option>> { self.stmt.and_then(|stmt| match stmt.step() { Ok(true) => Some(Ok(Row { diff --git a/src/statement.rs b/src/statement.rs index f1c7765..5217ce4 100644 --- a/src/statement.rs +++ b/src/statement.rs @@ -367,12 +367,7 @@ impl<'conn> Statement<'conn> { P::Item: ToSql, { let mut rows = try!(self.query(params)); - let exists = { - match rows.next() { - Some(_) => true, - None => false, - } - }; + let exists = rows.next().is_some(); Ok(exists) } diff --git a/src/vtab/mod.rs b/src/vtab/mod.rs index a219198..4b2fb08 100644 --- a/src/vtab/mod.rs +++ b/src/vtab/mod.rs @@ -467,7 +467,9 @@ impl<'a> Values<'a> { Error::FromSqlConversionFailure(idx, value.data_type(), err) } FromSqlError::OutOfRange(i) => Error::IntegralValueOutOfRange(idx, i), - }) + #[cfg(feature = "i128_blob")] + FromSqlError::InvalidI128Size(_) => Error::InvalidColumnType(idx, value.data_type()), + }) } // `sqlite3_value_type` returns `SQLITE_NULL` for pointer. From e7d392057981b484596351e534d6cc6482ab8355 Mon Sep 17 00:00:00 2001 From: gwenn Date: Thu, 1 Nov 2018 09:56:38 +0100 Subject: [PATCH 2/2] Scoped lints are experimental --- src/error.rs | 2 +- src/row.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/error.rs b/src/error.rs index ac4fc27..27674f8 100644 --- a/src/error.rs +++ b/src/error.rs @@ -12,7 +12,7 @@ pub type SqliteError = Error; /// Enum listing possible errors from rusqlite. #[derive(Debug)] -#[allow(clippy::enum_variant_names)] +#[allow(enum_variant_names)] pub enum Error { /// An error from an underlying SQLite call. SqliteFailure(ffi::Error, Option), diff --git a/src/row.rs b/src/row.rs index 2c4b761..095eaee 100644 --- a/src/row.rs +++ b/src/row.rs @@ -27,7 +27,7 @@ impl<'stmt> Rows<'stmt> { /// This is a "streaming iterator". For a more natural interface, /// consider using `query_map` or `query_and_then` instead, which /// return types that implement `Iterator`. - #[cfg_attr(feature = "cargo-clippy", allow(clippy::should_implement_trait))] // cannot implement Iterator + #[cfg_attr(feature = "cargo-clippy", allow(should_implement_trait))] // cannot implement Iterator pub fn next<'a>(&'a mut self) -> Option>> { self.stmt.and_then(|stmt| match stmt.step() { Ok(true) => Some(Ok(Row {