mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-22 16:29:20 +08:00
Clippy
This commit is contained in:
parent
ebc3609a09
commit
495f1d529a
@ -1,3 +1,4 @@
|
|||||||
|
#![feature(extern_crate_item_prelude)]
|
||||||
#![feature(test)]
|
#![feature(test)]
|
||||||
extern crate test;
|
extern crate test;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ pub type SqliteError = Error;
|
|||||||
|
|
||||||
/// Enum listing possible errors from rusqlite.
|
/// Enum listing possible errors from rusqlite.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[allow(enum_variant_names)]
|
#[allow(clippy::enum_variant_names)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// An error from an underlying SQLite call.
|
/// An error from an underlying SQLite call.
|
||||||
SqliteFailure(ffi::Error, Option<String>),
|
SqliteFailure(ffi::Error, Option<String>),
|
||||||
|
@ -147,7 +147,7 @@ pub mod vtab;
|
|||||||
// Number of cached prepared statements we'll hold on to.
|
// Number of cached prepared statements we'll hold on to.
|
||||||
const STATEMENT_CACHE_DEFAULT_CAPACITY: usize = 16;
|
const STATEMENT_CACHE_DEFAULT_CAPACITY: usize = 16;
|
||||||
/// To be used when your statement has no [parameter](https://sqlite.org/lang_expr.html#varparam).
|
/// 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.
|
/// Old name for `Result`. `SqliteResult` is deprecated.
|
||||||
#[deprecated(since = "0.6.0", note = "Use Result instead")]
|
#[deprecated(since = "0.6.0", note = "Use Result instead")]
|
||||||
|
@ -27,7 +27,7 @@ impl<'stmt> Rows<'stmt> {
|
|||||||
/// This is a "streaming iterator". For a more natural interface,
|
/// This is a "streaming iterator". For a more natural interface,
|
||||||
/// consider using `query_map` or `query_and_then` instead, which
|
/// consider using `query_map` or `query_and_then` instead, which
|
||||||
/// return types that implement `Iterator`.
|
/// 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<Result<Row<'a, 'stmt>>> {
|
pub fn next<'a>(&'a mut self) -> Option<Result<Row<'a, 'stmt>>> {
|
||||||
self.stmt.and_then(|stmt| match stmt.step() {
|
self.stmt.and_then(|stmt| match stmt.step() {
|
||||||
Ok(true) => Some(Ok(Row {
|
Ok(true) => Some(Ok(Row {
|
||||||
|
@ -367,12 +367,7 @@ impl<'conn> Statement<'conn> {
|
|||||||
P::Item: ToSql,
|
P::Item: ToSql,
|
||||||
{
|
{
|
||||||
let mut rows = try!(self.query(params));
|
let mut rows = try!(self.query(params));
|
||||||
let exists = {
|
let exists = rows.next().is_some();
|
||||||
match rows.next() {
|
|
||||||
Some(_) => true,
|
|
||||||
None => false,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Ok(exists)
|
Ok(exists)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -467,6 +467,8 @@ impl<'a> Values<'a> {
|
|||||||
Error::FromSqlConversionFailure(idx, value.data_type(), err)
|
Error::FromSqlConversionFailure(idx, value.data_type(), err)
|
||||||
}
|
}
|
||||||
FromSqlError::OutOfRange(i) => Error::IntegralValueOutOfRange(idx, i),
|
FromSqlError::OutOfRange(i) => Error::IntegralValueOutOfRange(idx, i),
|
||||||
|
#[cfg(feature = "i128_blob")]
|
||||||
|
FromSqlError::InvalidI128Size(_) => Error::InvalidColumnType(idx, value.data_type()),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user