mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 14:34:19 +00:00
fix clipyy warnings
This commit is contained in:
parent
204a65a464
commit
7f1bff406d
10 changed files with 34 additions and 31 deletions
|
@ -1,4 +1,5 @@
|
|||
mod error;
|
||||
#[allow(clippy::module_inception)]
|
||||
mod migrate;
|
||||
mod migration;
|
||||
mod migration_type;
|
||||
|
|
|
@ -58,12 +58,12 @@ impl SqliteArguments<'_> {
|
|||
for param_i in 1..=cnt {
|
||||
// figure out the index of this bind parameter into our argument tuple
|
||||
let n: usize = if let Some(name) = handle.bind_parameter_name(param_i) {
|
||||
if name.starts_with('?') {
|
||||
if let Some(name) = name.strip_prefix('?') {
|
||||
// parameter should have the form ?NNN
|
||||
atoi(name[1..].as_bytes()).expect("parameter of the form ?NNN")
|
||||
} else if name.starts_with('$') {
|
||||
atoi(name.as_bytes()).expect("parameter of the form ?NNN")
|
||||
} else if let Some(name) = name.strip_prefix('$') {
|
||||
// parameter should have the form $NNN
|
||||
atoi(name[1..].as_bytes()).ok_or_else(|| {
|
||||
atoi(name.as_bytes()).ok_or_else(|| {
|
||||
err_protocol!(
|
||||
"parameters with non-integer names are not currently supported: {}",
|
||||
name
|
||||
|
|
|
@ -110,8 +110,8 @@ impl<'c> Executor<'c> for &'c mut SqliteConnection {
|
|||
};
|
||||
|
||||
let done = SqliteDone {
|
||||
changes: changes,
|
||||
last_insert_rowid: last_insert_rowid,
|
||||
changes,
|
||||
last_insert_rowid,
|
||||
};
|
||||
|
||||
r#yield!(Either::Left(done));
|
||||
|
|
|
@ -47,6 +47,7 @@ const OP_REMAINDER: &str = "Remainder";
|
|||
const OP_CONCAT: &str = "Concat";
|
||||
const OP_RESULT_ROW: &str = "ResultRow";
|
||||
|
||||
#[allow(clippy::wildcard_in_or_patterns)]
|
||||
fn affinity_to_type(affinity: u8) -> DataType {
|
||||
match affinity {
|
||||
SQLITE_AFF_BLOB => DataType::Blob,
|
||||
|
@ -59,6 +60,7 @@ fn affinity_to_type(affinity: u8) -> DataType {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::wildcard_in_or_patterns)]
|
||||
fn opcode_to_type(op: &str) -> DataType {
|
||||
match op {
|
||||
OP_REAL => DataType::Float,
|
||||
|
@ -115,14 +117,10 @@ pub(super) async fn explain(
|
|||
|
||||
OP_FUNCTION => {
|
||||
// r[p1] = func( _ )
|
||||
match from_utf8(p4).map_err(Error::protocol)? {
|
||||
"last_insert_rowid(0)" => {
|
||||
// last_insert_rowid() -> INTEGER
|
||||
r.insert(p3, DataType::Int64);
|
||||
n.insert(p3, false);
|
||||
}
|
||||
|
||||
_ => {}
|
||||
if from_utf8(p4).map_err(Error::protocol)? == "last_insert_rowid(0)" {
|
||||
// last_insert_rowid() -> INTEGER
|
||||
r.insert(p3, DataType::Int64);
|
||||
n.insert(p3, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -108,11 +108,11 @@ CREATE TABLE IF NOT EXISTS _sqlx_migrations (
|
|||
.await?;
|
||||
|
||||
if let Some(checksum) = checksum {
|
||||
return if checksum == &*migration.checksum {
|
||||
if checksum == &*migration.checksum {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(MigrateError::VersionMismatch(migration.version))
|
||||
};
|
||||
}
|
||||
} else {
|
||||
Err(MigrateError::VersionMissing(migration.version))
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#![allow(clippy::rc_buffer)]
|
||||
|
||||
use std::ptr::null_mut;
|
||||
use std::slice;
|
||||
use std::sync::atomic::{AtomicPtr, Ordering};
|
||||
|
@ -67,6 +69,7 @@ impl SqliteRow {
|
|||
|
||||
// inflates this Row into memory as a list of owned, protected SQLite value objects
|
||||
// this is called by the
|
||||
#[allow(clippy::needless_range_loop)]
|
||||
pub(crate) fn inflate(
|
||||
statement: &StatementHandle,
|
||||
columns: &[SqliteColumn],
|
||||
|
|
|
@ -17,6 +17,7 @@ pub(crate) use r#virtual::VirtualStatement;
|
|||
pub(crate) use worker::StatementWorker;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[allow(clippy::rc_buffer)]
|
||||
pub struct SqliteStatement<'q> {
|
||||
pub(crate) sql: Cow<'q, str>,
|
||||
pub(crate) parameters: usize,
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#![allow(clippy::rc_buffer)]
|
||||
|
||||
use crate::error::Error;
|
||||
use crate::ext::ustr::UStr;
|
||||
use crate::sqlite::connection::ConnectionHandle;
|
||||
|
|
|
@ -128,24 +128,21 @@ pub fn parse_child_attributes(input: &[Attribute]) -> syn::Result<SqlxChildAttri
|
|||
.parse_meta()
|
||||
.map_err(|e| syn::Error::new_spanned(attr, e))?;
|
||||
|
||||
match meta {
|
||||
Meta::List(list) => {
|
||||
for value in list.nested.iter() {
|
||||
match value {
|
||||
NestedMeta::Meta(meta) => match meta {
|
||||
Meta::NameValue(MetaNameValue {
|
||||
path,
|
||||
lit: Lit::Str(val),
|
||||
..
|
||||
}) if path.is_ident("rename") => try_set!(rename, val.value(), value),
|
||||
Meta::Path(path) if path.is_ident("default") => default = true,
|
||||
u => fail!(u, "unexpected attribute"),
|
||||
},
|
||||
if let Meta::List(list) = meta {
|
||||
for value in list.nested.iter() {
|
||||
match value {
|
||||
NestedMeta::Meta(meta) => match meta {
|
||||
Meta::NameValue(MetaNameValue {
|
||||
path,
|
||||
lit: Lit::Str(val),
|
||||
..
|
||||
}) if path.is_ident("rename") => try_set!(rename, val.value(), value),
|
||||
Meta::Path(path) if path.is_ident("default") => default = true,
|
||||
u => fail!(u, "unexpected attribute"),
|
||||
}
|
||||
},
|
||||
u => fail!(u, "unexpected attribute"),
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ use std::marker::PhantomData;
|
|||
// specialization (but this works only if all types are statically known, i.e. we're not in a
|
||||
// generic context; this should suit 99% of use cases for the macros).
|
||||
|
||||
#[allow(clippy::just_underscores_and_digits)]
|
||||
pub fn same_type<T>(_1: &T, _2: &T) {}
|
||||
|
||||
pub struct WrapSame<T, U>(PhantomData<T>, PhantomData<U>);
|
||||
|
|
Loading…
Reference in a new issue