Skip to content

Commit c56e7b4

Browse files
committed
core: remove extraneous clippy allows in lib.rs
1 parent 93237ec commit c56e7b4

File tree

9 files changed

+65
-37
lines changed

9 files changed

+65
-37
lines changed

sqlx-core/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
clippy::cast_precision_loss,
1010
clippy::cast_sign_loss
1111
)]
12-
#![allow(
13-
clippy::multiple_bound_locations,
14-
clippy::empty_line_after_doc_comments
15-
)]
1612
// See `clippy.toml` at the workspace root
1713
#![deny(clippy::disallowed_methods)]
1814
//

sqlx-core/src/mssql/column.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ impl Column for MssqlColumn {
3232
self.ordinal
3333
}
3434

35-
fn name(&self) -> &str { &self.name }
35+
fn name(&self) -> &str {
36+
&self.name
37+
}
3638

3739
fn type_info(&self) -> &MssqlTypeInfo {
3840
&self.type_info

sqlx-core/src/mysql/column.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ impl Column for MySqlColumn {
2323
self.ordinal
2424
}
2525

26-
fn name(&self) -> &str { &self.name }
26+
fn name(&self) -> &str {
27+
&self.name
28+
}
2729

2830
fn type_info(&self) -> &MySqlTypeInfo {
2931
&self.type_info

sqlx-core/src/pool/inner.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ impl<DB: Database> PoolInner<DB> {
143143
if parent_close_event.as_mut().poll(cx).is_ready() {
144144
// Propagate the parent's close event to the child.
145145
let pool = Arc::clone(self);
146-
sqlx_rt::spawn(async move { let _ = pool.close().await; });
146+
sqlx_rt::spawn(async move {
147+
let _ = pool.close().await;
148+
});
147149
return Poll::Ready(Err(Error::PoolClosed));
148150
}
149151

sqlx-core/src/sqlite/column.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ impl Column for SqliteColumn {
1919
self.ordinal
2020
}
2121

22-
fn name(&self) -> &str { &self.name }
22+
fn name(&self) -> &str {
23+
&self.name
24+
}
2325

2426
fn type_info(&self) -> &SqliteTypeInfo {
2527
&self.type_info

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

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -364,14 +364,16 @@ pub(super) fn explain(
364364
OP_INIT => {
365365
// start at <p2>
366366
state.visited[state.program_i] = true;
367-
state.program_i = usize::try_from(p2).expect("opcode p2 should be non-negative");
367+
state.program_i =
368+
usize::try_from(p2).expect("opcode p2 should be non-negative");
368369
continue;
369370
}
370371

371372
OP_GOTO => {
372373
// goto <p2>
373374
state.visited[state.program_i] = true;
374-
state.program_i = usize::try_from(p2).expect("opcode p2 should be non-negative");
375+
state.program_i =
376+
usize::try_from(p2).expect("opcode p2 should be non-negative");
375377
continue;
376378
}
377379

@@ -388,7 +390,8 @@ pub(super) fn explain(
388390
state.visited[state.program_i] = true;
389391

390392
let mut branch_state = state.clone();
391-
branch_state.program_i = usize::try_from(p2).expect("branch p2 should be non-negative");
393+
branch_state.program_i =
394+
usize::try_from(p2).expect("branch p2 should be non-negative");
392395
states.push(branch_state);
393396

394397
state.program_i += 1;
@@ -401,7 +404,8 @@ pub(super) fn explain(
401404
state.r.insert(p1, RegDataType::Int(p3));
402405

403406
if p2 != 0 {
404-
state.program_i = usize::try_from(p2).expect("opcode p2 should be non-negative");
407+
state.program_i =
408+
usize::try_from(p2).expect("opcode p2 should be non-negative");
405409
} else {
406410
state.program_i += 1;
407411
}
@@ -412,11 +416,12 @@ pub(super) fn explain(
412416
// jump to p2 of the yield instruction pointed at by register p1
413417
state.visited[state.program_i] = true;
414418
if let Some(RegDataType::Int(yield_i)) = state.r.get(&p1) {
415-
if let Some((_, yield_op, _, yield_p2, _, _)) =
416-
program.get(usize::try_from(*yield_i).expect("yield index should be non-negative"))
417-
{
419+
if let Some((_, yield_op, _, yield_p2, _, _)) = program.get(
420+
usize::try_from(*yield_i).expect("yield index should be non-negative"),
421+
) {
418422
if OP_YIELD == yield_op.as_str() {
419-
state.program_i = usize::try_from(*yield_p2).expect("yield p2 should be non-negative");
423+
state.program_i = usize::try_from(*yield_p2)
424+
.expect("yield p2 should be non-negative");
420425
state.r.remove(&p1);
421426
continue;
422427
} else {
@@ -434,7 +439,8 @@ pub(super) fn explain(
434439
// jump to the instruction after the instruction pointed at by register p1
435440
state.visited[state.program_i] = true;
436441
if let Some(RegDataType::Int(return_i)) = state.r.get(&p1) {
437-
state.program_i = usize::try_from(*return_i + 1).expect("return index should be non-negative");
442+
state.program_i = usize::try_from(*return_i + 1)
443+
.expect("return index should be non-negative");
438444
state.r.remove(&p1);
439445
continue;
440446
} else {
@@ -450,15 +456,20 @@ pub(super) fn explain(
450456

451457
//if yielding to a yield operation, go to the NEXT instruction after that instruction
452458
if program
453-
.get(usize::try_from(*yield_i).expect("yield index should be non-negative"))
459+
.get(
460+
usize::try_from(*yield_i)
461+
.expect("yield index should be non-negative"),
462+
)
454463
.map(|(_, yield_op, _, _, _, _)| yield_op.as_str())
455464
== Some(OP_YIELD)
456465
{
457-
state.program_i = usize::try_from(*yield_i + 1).expect("yield+1 should be non-negative");
466+
state.program_i = usize::try_from(*yield_i + 1)
467+
.expect("yield+1 should be non-negative");
458468
*yield_i = program_i as i64;
459469
continue;
460470
} else {
461-
state.program_i = usize::try_from(*yield_i).expect("yield index should be non-negative");
471+
state.program_i = usize::try_from(*yield_i)
472+
.expect("yield index should be non-negative");
462473
*yield_i = program_i as i64;
463474
continue;
464475
}
@@ -472,15 +483,18 @@ pub(super) fn explain(
472483
state.visited[state.program_i] = true;
473484

474485
let mut branch_state = state.clone();
475-
branch_state.program_i = usize::try_from(p1).expect("branch p1 should be non-negative");
486+
branch_state.program_i =
487+
usize::try_from(p1).expect("branch p1 should be non-negative");
476488
states.push(branch_state);
477489

478490
let mut branch_state = state.clone();
479-
branch_state.program_i = usize::try_from(p2).expect("branch p2 should be non-negative");
491+
branch_state.program_i =
492+
usize::try_from(p2).expect("branch p2 should be non-negative");
480493
states.push(branch_state);
481494

482495
let mut branch_state = state.clone();
483-
branch_state.program_i = usize::try_from(p3).expect("branch p3 should be non-negative");
496+
branch_state.program_i =
497+
usize::try_from(p3).expect("branch p3 should be non-negative");
484498
states.push(branch_state);
485499
}
486500

@@ -515,7 +529,9 @@ pub(super) fn explain(
515529

516530
OP_MAKE_RECORD => {
517531
// p3 = Record([p1 .. p1 + p2])
518-
let mut record = Vec::with_capacity(usize::try_from(p2).expect("record len should be non-negative"));
532+
let mut record = Vec::with_capacity(
533+
usize::try_from(p2).expect("record len should be non-negative"),
534+
);
519535
for reg in p1..p1 + p2 {
520536
record.push(
521537
state
@@ -565,9 +581,12 @@ pub(super) fn explain(
565581
//Create a new pointer which is referenced by p1
566582
state.p.insert(
567583
p1,
568-
CursorDataType::from_dense_record(
569-
&vec![ColumnType::null(); usize::try_from(p2).expect("record len should be non-negative")],
570-
),
584+
CursorDataType::from_dense_record(&vec![
585+
ColumnType::null();
586+
usize::try_from(p2).expect(
587+
"record len should be non-negative"
588+
)
589+
]),
571590
);
572591
}
573592

sqlx-core/src/sqlite/statement/handle.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl StatementHandle {
9090
unsafe {
9191
let name = sqlite3_column_name(
9292
self.0.as_ptr(),
93-
c_int::try_from(index).expect("column_name index exceeds c_int")
93+
c_int::try_from(index).expect("column_name index exceeds c_int"),
9494
);
9595
debug_assert!(!name.is_null());
9696

@@ -114,7 +114,7 @@ impl StatementHandle {
114114
unsafe {
115115
let decl = sqlite3_column_decltype(
116116
self.0.as_ptr(),
117-
c_int::try_from(index).expect("column_decltype index exceeds c_int")
117+
c_int::try_from(index).expect("column_decltype index exceeds c_int"),
118118
);
119119
if decl.is_null() {
120120
// If the Nth column of the result set is an expression or subquery,
@@ -195,7 +195,7 @@ impl StatementHandle {
195195
// https://www.sqlite.org/c3ref/bind_parameter_name.html
196196
let name = sqlite3_bind_parameter_name(
197197
self.0.as_ptr(),
198-
c_int::try_from(index).expect("bind_parameter_name index exceeds c_int")
198+
c_int::try_from(index).expect("bind_parameter_name index exceeds c_int"),
199199
);
200200
if name.is_null() {
201201
return None;
@@ -270,12 +270,16 @@ impl StatementHandle {
270270

271271
#[inline]
272272
pub(crate) fn column_int(&self, index: usize) -> i32 {
273-
unsafe { sqlite3_column_int(self.0.as_ptr(), index.try_into().unwrap_or(c_int::MAX)) as i32 }
273+
unsafe {
274+
sqlite3_column_int(self.0.as_ptr(), index.try_into().unwrap_or(c_int::MAX)) as i32
275+
}
274276
}
275277

276278
#[inline]
277279
pub(crate) fn column_int64(&self, index: usize) -> i64 {
278-
unsafe { sqlite3_column_int64(self.0.as_ptr(), index.try_into().unwrap_or(c_int::MAX)) as i64 }
280+
unsafe {
281+
sqlite3_column_int64(self.0.as_ptr(), index.try_into().unwrap_or(c_int::MAX)) as i64
282+
}
279283
}
280284

281285
#[inline]

sqlx-core/src/sqlite/statement/virtual.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ use libsqlite3_sys::{
1111
sqlite3, sqlite3_prepare_v3, sqlite3_stmt, SQLITE_OK, SQLITE_PREPARE_PERSISTENT,
1212
};
1313
use smallvec::SmallVec;
14+
use std::cmp;
1415
use std::os::raw::c_char;
1516
use std::ptr::{null, null_mut, NonNull};
1617
use std::sync::Arc;
17-
use std::cmp;
1818

1919
// A virtual statement consists of *zero* or more raw SQLite3 statements. We chop up a SQL statement
2020
// on `;` to support multiple statements in one query.

sqlx-core/src/sqlite/value.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,11 @@ impl SqliteValue {
126126
}
127127

128128
fn blob(&self) -> &[u8] {
129-
let len: usize = match usize::try_from(unsafe { sqlite3_value_bytes(self.handle.0.as_ptr()) }) {
130-
Ok(v) => v,
131-
Err(_) => return &[],
132-
};
129+
let len: usize =
130+
match usize::try_from(unsafe { sqlite3_value_bytes(self.handle.0.as_ptr()) }) {
131+
Ok(v) => v,
132+
Err(_) => return &[],
133+
};
133134

134135
if len == 0 {
135136
// empty blobs are NULL so just return an empty slice

0 commit comments

Comments
 (0)