Skip to content

Commit be6c979

Browse files
committed
fix new warnings
1 parent fc91f14 commit be6c979

File tree

8 files changed

+25
-21
lines changed

8 files changed

+25
-21
lines changed

sqlx-core/src/net/socket/buffered.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::{cmp, io};
44

55
use crate::error::Error;
66

7-
use crate::io::{Decode, Encode, AsyncRead, AsyncReadExt};
7+
use crate::io::{AsyncRead, AsyncReadExt, Decode, Encode};
88

99
// Tokio, async-std, and std all use this as the default capacity for their buffered I/O.
1010
const DEFAULT_BUF_SIZE: usize = 8192;
@@ -167,9 +167,9 @@ impl WriteBuffer {
167167

168168
self.sanity_check();
169169
}
170-
170+
171171
/// Read into the buffer from `source`, returning the number of bytes read.
172-
///
172+
///
173173
/// The buffer is automatically advanced by the number of bytes read.
174174
pub async fn read_from(&mut self, mut source: impl AsyncRead + Unpin) -> io::Result<usize> {
175175
let read = match () {
@@ -179,11 +179,11 @@ impl WriteBuffer {
179179
#[cfg(not(feature = "_rt-tokio"))]
180180
_ => source.read(self.init_remaining_mut()).await?,
181181
};
182-
182+
183183
if read > 0 {
184184
self.advance(read);
185185
}
186-
186+
187187
Ok(read)
188188
}
189189

sqlx-macros-core/Cargo.toml

+5
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,8 @@ syn = { version = "2.0.52", default-features = false, features = ["full", "deriv
6262
tempfile = { version = "3.10.1" }
6363
quote = { version = "1.0.26", default-features = false }
6464
url = { version = "2.2.2", default-features = false }
65+
66+
[lints.rust.unexpected_cfgs]
67+
level = "warn"
68+
# 1.80 will warn without this
69+
check-cfg = ['cfg(sqlx_macros_unstable)', 'cfg(procmacro2_semver_exempt)']

sqlx-macros-core/src/derives/attributes.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use proc_macro2::{Ident, Span, TokenStream};
2-
use quote::quote;
2+
use quote::quote_spanned;
33
use syn::{
44
punctuated::Punctuated, token::Comma, Attribute, DeriveInput, Field, LitStr, Meta, Token, Type,
55
Variant,
@@ -36,7 +36,7 @@ pub struct TypeName {
3636
impl TypeName {
3737
pub fn get(&self) -> TokenStream {
3838
let val = &self.val;
39-
quote! { #val }
39+
quote_spanned! { self.span => #val }
4040
}
4141
}
4242

sqlx-macros-core/src/query/data.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl DynQueryData {
9898
return Ok(cached);
9999
}
100100

101-
#[cfg(procmacr2_semver_exempt)]
101+
#[cfg(procmacro2_semver_exempt)]
102102
{
103103
let path = path.as_ref().canonicalize()?;
104104
let path = path.to_str().ok_or_else(|| {

sqlx-postgres/src/copy.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
use futures_core::future::BoxFuture;
21
use std::borrow::Cow;
32
use std::ops::{Deref, DerefMut};
43

4+
use futures_core::future::BoxFuture;
55
use futures_core::stream::BoxStream;
6+
67
use sqlx_core::bytes::{BufMut, Bytes};
78

89
use crate::connection::PgConnection;
910
use crate::error::{Error, Result};
1011
use crate::ext::async_stream::TryAsyncStream;
11-
use crate::io::{AsyncRead, AsyncReadExt};
12+
use crate::io::AsyncRead;
1213
use crate::message::{
1314
CommandComplete, CopyData, CopyDone, CopyFail, CopyResponse, MessageFormat, Query,
1415
};
@@ -45,7 +46,7 @@ impl PgConnection {
4546
///
4647
/// 1. by closing the connection, or:
4748
/// 2. by using another connection to kill the server process that is sending the data as shown
48-
/// [in this StackOverflow answer](https://stackoverflow.com/a/35319598).
49+
/// [in this StackOverflow answer](https://stackoverflow.com/a/35319598).
4950
///
5051
/// If you don't read the stream to completion, the next time the connection is used it will
5152
/// need to read and discard all the remaining queued data, which could take some time.
@@ -98,7 +99,7 @@ pub trait PgPoolCopyExt {
9899
///
99100
/// 1. by closing the connection, or:
100101
/// 2. by using another connection to kill the server process that is sending the data as shown
101-
/// [in this StackOverflow answer](https://stackoverflow.com/a/35319598).
102+
/// [in this StackOverflow answer](https://stackoverflow.com/a/35319598).
102103
///
103104
/// If you don't read the stream to completion, the next time the connection is used it will
104105
/// need to read and discard all the remaining queued data, which could take some time.

sqlx-postgres/src/message/parse.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use std::i16;
2-
31
use crate::io::PgBufMutExt;
42
use crate::io::{BufMutExt, Encode};
53
use crate::types::Oid;

sqlx-sqlite/src/statement/virtual.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#![allow(clippy::rc_buffer)]
22

3+
use std::cmp;
34
use std::os::raw::c_char;
45
use std::ptr::{null, null_mut, NonNull};
56
use std::sync::Arc;
6-
use std::{cmp, i32};
77

88
use libsqlite3_sys::{
99
sqlite3, sqlite3_prepare_v3, sqlite3_stmt, SQLITE_OK, SQLITE_PREPARE_PERSISTENT,
@@ -56,7 +56,7 @@ impl VirtualStatement {
5656
pub(crate) fn new(mut query: &str, persistent: bool) -> Result<Self, Error> {
5757
query = query.trim();
5858

59-
if query.len() > i32::max_value() as usize {
59+
if query.len() > i32::MAX as usize {
6060
return Err(err_protocol!(
6161
"query string must be smaller than {} bytes",
6262
i32::MAX

sqlx-sqlite/src/types/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@
124124
//! [Datatypes in SQLite: Type Affinity][type-affinity] (accessed 2023/11/20):
125125
//!
126126
//! > A column with NUMERIC affinity may contain values using all five storage classes.
127-
//! When text data is inserted into a NUMERIC column, the storage class of the text is converted to
128-
//! INTEGER or REAL (in order of preference) if the text is a well-formed integer or real literal,
129-
//! respectively. If the TEXT value is a well-formed integer literal that is too large to fit in a
130-
//! 64-bit signed integer, it is converted to REAL. For conversions between TEXT and REAL storage
131-
//! classes, only the first 15 significant decimal digits of the number are preserved.
127+
//! > When text data is inserted into a NUMERIC column, the storage class of the text is converted to
128+
//! > INTEGER or REAL (in order of preference) if the text is a well-formed integer or real literal,
129+
//! > respectively. If the TEXT value is a well-formed integer literal that is too large to fit in a
130+
//! > 64-bit signed integer, it is converted to REAL. For conversions between TEXT and REAL storage
131+
//! > classes, only the first 15 significant decimal digits of the number are preserved.
132132
//!
133133
//! With the SQLite3 interactive CLI, we can see that a higher-precision value
134134
//! (20 digits in this case) is rounded off:

0 commit comments

Comments
 (0)