mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 15:25:32 +00:00
Allow clippy::suspicious_else_formatting when expanding query arguments.
Expanding several query arguments in the query! macro creates several if false { ... } statements, which in turn trigger clippy's suspicious_else_formatting (https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_else_formatting). This commit allows the clippy lint so users won't be disturbed by it.
This commit is contained in:
parent
c1e79d2675
commit
9d11c7a7f1
@ -74,23 +74,26 @@ pub fn quote_args<DB: DatabaseExt>(
|
||||
};
|
||||
|
||||
Ok(quote_spanned!(expr.span() =>
|
||||
// this shouldn't actually run
|
||||
if false {
|
||||
use sqlx::ty_match::{WrapSameExt as _, MatchBorrowExt as _};
|
||||
#[allow(clippy::suspicious_else_formatting)]
|
||||
{
|
||||
// this shouldn't actually run
|
||||
if false {
|
||||
use sqlx::ty_match::{WrapSameExt as _, MatchBorrowExt as _};
|
||||
|
||||
// evaluate the expression only once in case it contains moves
|
||||
let _expr = sqlx::ty_match::dupe_value(#name);
|
||||
// evaluate the expression only once in case it contains moves
|
||||
let _expr = sqlx::ty_match::dupe_value(#name);
|
||||
|
||||
// if `_expr` is `Option<T>`, get `Option<$ty>`, otherwise `$ty`
|
||||
let ty_check = sqlx::ty_match::WrapSame::<#param_ty, _>::new(&_expr).wrap_same();
|
||||
// if `_expr` is `Option<T>`, get `Option<$ty>`, otherwise `$ty`
|
||||
let ty_check = sqlx::ty_match::WrapSame::<#param_ty, _>::new(&_expr).wrap_same();
|
||||
|
||||
// if `_expr` is `&str`, convert `String` to `&str`
|
||||
let (mut _ty_check, match_borrow) = sqlx::ty_match::MatchBorrow::new(ty_check, &_expr);
|
||||
// if `_expr` is `&str`, convert `String` to `&str`
|
||||
let (mut _ty_check, match_borrow) = sqlx::ty_match::MatchBorrow::new(ty_check, &_expr);
|
||||
|
||||
_ty_check = match_borrow.match_borrow();
|
||||
_ty_check = match_borrow.match_borrow();
|
||||
|
||||
// this causes move-analysis to effectively ignore this block
|
||||
panic!();
|
||||
// this causes move-analysis to effectively ignore this block
|
||||
panic!();
|
||||
}
|
||||
}
|
||||
))
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user