Skip to content

Commit 3dbabb1

Browse files
committed
sqlite: remove clippy allows; switch columns Vec->slice; simplify wildcard matches
1 parent c56e7b4 commit 3dbabb1

File tree

14 files changed

+9
-29
lines changed

14 files changed

+9
-29
lines changed

examples/postgres/axum-social-with-tests/tests/common.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// This is imported by different tests that use different functions.
2-
#![allow(dead_code)]
32

43
use axum::body::{Body, BoxBody, HttpBody};
54
use axum::http::header::CONTENT_TYPE;

sqlx-core/src/io/buf_stream.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(dead_code)]
2-
31
use std::io;
42
use std::ops::{Deref, DerefMut};
53

sqlx-core/src/io/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![allow(unused_imports)]
21
mod buf;
32
mod buf_mut;
43
mod buf_stream;

sqlx-core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//! Not intended to be used directly.
33
#![recursion_limit = "512"]
44
#![warn(future_incompatible, rust_2018_idioms)]
5-
#![allow(clippy::needless_doctest_main, clippy::type_complexity, dead_code)]
5+
#![allow(clippy::needless_doctest_main, clippy::type_complexity)]
66
#![deny(
77
clippy::cast_possible_truncation,
88
clippy::cast_possible_wrap,

sqlx-core/src/net/socket.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(dead_code)]
2-
31
use std::io;
42
use std::net::SocketAddr;
53
use std::path::Path;

sqlx-core/src/net/tls/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(dead_code)]
2-
31
use std::io;
42
use std::ops::{Deref, DerefMut};
53
use std::path::PathBuf;

sqlx-core/src/postgres/type_info.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(dead_code)]
2-
31
use std::borrow::Cow;
42
use std::fmt::{self, Display, Formatter};
53
use std::ops::Deref;

sqlx-core/src/sqlite/connection/explain.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ impl CursorDataType {
228228
}
229229
}
230230

231-
#[allow(clippy::wildcard_in_or_patterns)]
232231
fn affinity_to_type(affinity: u8) -> DataType {
233232
match affinity {
234233
SQLITE_AFF_BLOB => DataType::Blob,
@@ -237,19 +236,18 @@ fn affinity_to_type(affinity: u8) -> DataType {
237236
SQLITE_AFF_REAL => DataType::Float,
238237
SQLITE_AFF_TEXT => DataType::Text,
239238

240-
SQLITE_AFF_NONE | _ => DataType::Null,
239+
_ => DataType::Null,
241240
}
242241
}
243242

244-
#[allow(clippy::wildcard_in_or_patterns)]
245243
fn opcode_to_type(op: &str) -> DataType {
246244
match op {
247245
OP_REAL => DataType::Float,
248246
OP_BLOB => DataType::Blob,
249247
OP_AND | OP_OR => DataType::Bool,
250248
OP_ROWID | OP_COUNT | OP_INT64 | OP_INTEGER => DataType::Int64,
251249
OP_STRING8 => DataType::Text,
252-
OP_COLUMN | _ => DataType::Null,
250+
_ => DataType::Null,
253251
}
254252
}
255253

sqlx-core/src/sqlite/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// SQLite is a C library. All interactions require FFI which is unsafe.
44
// All unsafe blocks should have comments pointing to SQLite docs and ensuring that we maintain
55
// invariants.
6-
#![allow(unsafe_code)]
76

87
pub use arguments::{SqliteArgumentValue, SqliteArguments};
98
pub use column::SqliteColumn;

sqlx-core/src/sqlite/row.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(clippy::rc_buffer)]
2-
31
use std::sync::Arc;
42

53
use crate::HashMap;
@@ -14,7 +12,7 @@ use crate::sqlite::{Sqlite, SqliteColumn, SqliteValue, SqliteValueRef};
1412
/// Implementation of [`Row`] for SQLite.
1513
pub struct SqliteRow {
1614
pub(crate) values: Box<[SqliteValue]>,
17-
pub(crate) columns: Arc<Vec<SqliteColumn>>,
15+
pub(crate) columns: Arc<[SqliteColumn]>,
1816
pub(crate) column_names: Arc<HashMap<UStr, usize>>,
1917
}
2018

@@ -32,7 +30,7 @@ unsafe impl Sync for SqliteRow {}
3230
impl SqliteRow {
3331
pub(crate) fn current(
3432
statement: &StatementHandle,
35-
columns: &Arc<Vec<SqliteColumn>>,
33+
columns: &Arc<[SqliteColumn]>,
3634
column_names: &Arc<HashMap<UStr, usize>>,
3735
) -> Self {
3836
let size = statement.column_count();

0 commit comments

Comments
 (0)