mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-15 01:17:16 +00:00
Checking for proc_macro not only when local.init is Some
This commit is contained in:
parent
df200aaf39
commit
2d9d81fc1e
1 changed files with 12 additions and 12 deletions
|
@ -192,18 +192,18 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
|
|||
if local.pat.default_binding_modes && local.ty.is_none() {
|
||||
// When `default_binding_modes` is true, the `let` keyword is present.
|
||||
|
||||
if let Some(init) = local.init {
|
||||
// Ignore function calls that return impl traits...
|
||||
if matches!(init.kind, ExprKind::Call(_, _) | ExprKind::MethodCall(_, _, _, _)) {
|
||||
let expr_ty = cx.typeck_results().expr_ty(init);
|
||||
if expr_ty.is_impl_trait() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Ignore if it is from a procedural macro...
|
||||
if is_from_proc_macro(cx, init) {
|
||||
return;
|
||||
}
|
||||
// Ignore function calls that return impl traits...
|
||||
if let Some(init) = local.init &&
|
||||
matches!(init.kind, ExprKind::Call(_, _) | ExprKind::MethodCall(_, _, _, _)) {
|
||||
let expr_ty = cx.typeck_results().expr_ty(init);
|
||||
if expr_ty.is_impl_trait() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Ignore if it is from a procedural macro...
|
||||
if is_from_proc_macro(cx, init) {
|
||||
return;
|
||||
}
|
||||
|
||||
span_lint_and_help(
|
||||
|
|
Loading…
Reference in a new issue