Skip to content

Commit f4f774a

Browse files
committed
clippy
1 parent 79034b4 commit f4f774a

File tree

4 files changed

+9
-15
lines changed

4 files changed

+9
-15
lines changed

sqlx-macros/src/common.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ pub(crate) fn resolve_path(path: impl AsRef<Path>, err_span: Span) -> syn::Resul
1414

1515
// requires `proc_macro::SourceFile::path()` to be stable
1616
// https://github.com/rust-lang/rust/issues/54725
17-
if path.is_relative()
18-
&& !path
19-
.parent()
20-
.map_or(false, |parent| !parent.as_os_str().is_empty())
21-
{
17+
if path.is_relative() && path.parent().is_none_or(|p| p.as_os_str().is_empty()) {
2218
return Err(syn::Error::new(
2319
err_span,
2420
"paths relative to the current file's directory are not currently supported",

sqlx-macros/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::large_enum_variant)]
12
#![cfg_attr(
23
not(any(feature = "postgres", feature = "mysql", feature = "offline")),
34
allow(dead_code, unused_macros, unused_imports)

sqlx-macros/src/migrate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ impl ToTokens for QuotedMigrationType {
1919
quote! { ::sqlx_oldapi::migrate::MigrationType::ReversibleDown }
2020
}
2121
};
22-
tokens.append_all(ts.into_iter());
22+
tokens.append_all(ts);
2323
}
2424
}
2525

@@ -101,7 +101,7 @@ pub(crate) fn expand_migrator(path: &Path) -> crate::Result<TokenStream> {
101101
.replace('_', " ")
102102
.to_owned();
103103

104-
let sql = fs::read_to_string(&entry.path())?;
104+
let sql = fs::read_to_string(entry.path())?;
105105

106106
let checksum = Vec::from(Sha384::digest(sql.as_bytes()).as_slice());
107107

sqlx-macros/src/query/mod.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ static METADATA: Lazy<Metadata> = Lazy::new(|| {
125125
}
126126
});
127127

128+
#[allow(unused_variables)]
128129
pub fn expand_input(input: QueryMacroInput) -> crate::Result<TokenStream> {
129130
match &*METADATA {
130131
#[cfg(not(any(
@@ -135,7 +136,7 @@ pub fn expand_input(input: QueryMacroInput) -> crate::Result<TokenStream> {
135136
)))]
136137
Metadata {
137138
offline: false,
138-
database_url: Some(db_url),
139+
database_url: Some(_db_url),
139140
..
140141
} => Err(
141142
"At least one of the features ['postgres', 'mysql', 'mssql', 'sqlite'] must be enabled \
@@ -359,13 +360,9 @@ where
359360
}
360361
}
361362

362-
let record_fields = columns.iter().map(
363-
|&output::RustColumn {
364-
ref ident,
365-
ref type_,
366-
..
367-
}| quote!(#ident: #type_,),
368-
);
363+
let record_fields = columns
364+
.iter()
365+
.map(|output::RustColumn { ident, type_, .. }| quote!(#ident: #type_,));
369366

370367
let mut record_tokens = quote! {
371368
#[derive(Debug)]

0 commit comments

Comments
 (0)