Ignoring let_underscore_untyped warnings in code from proc macros

This commit is contained in:
Renato Lochetti 2023-05-14 10:26:48 +01:00
parent a167973e81
commit e234dfa63e
No known key found for this signature in database
GPG key ID: FDE4EF56C479D308
3 changed files with 40 additions and 20 deletions

View file

@ -1,6 +1,12 @@
//@aux-build: proc_macros.rs
#![allow(unused)]
#![warn(clippy::let_underscore_untyped)]
extern crate proc_macros;
use proc_macros::with_span;
use clippy_utils::is_from_proc_macro;
use std::future::Future;
use std::{boxed::Box, fmt::Display};
@ -32,6 +38,14 @@ fn g() -> impl Fn() {
|| {}
}
with_span!(
span
fn dont_lint_proc_macro() {
let _ = a();
}
);
fn main() {
let _ = a();
let _ = b(1);

View file

@ -1,60 +1,60 @@
error: non-binding `let` without a type annotation
--> $DIR/let_underscore_untyped.rs:36:5
--> $DIR/let_underscore_untyped.rs:50:5
|
LL | let _ = a();
| ^^^^^^^^^^^^
|
help: consider adding a type annotation
--> $DIR/let_underscore_untyped.rs:36:10
--> $DIR/let_underscore_untyped.rs:50:10
|
LL | let _ = a();
| ^
= note: `-D clippy::let-underscore-untyped` implied by `-D warnings`
error: non-binding `let` without a type annotation
--> $DIR/let_underscore_untyped.rs:37:5
--> $DIR/let_underscore_untyped.rs:51:5
|
LL | let _ = b(1);
| ^^^^^^^^^^^^^
|
help: consider adding a type annotation
--> $DIR/let_underscore_untyped.rs:37:10
--> $DIR/let_underscore_untyped.rs:51:10
|
LL | let _ = b(1);
| ^
error: non-binding `let` without a type annotation
--> $DIR/let_underscore_untyped.rs:39:5
--> $DIR/let_underscore_untyped.rs:53:5
|
LL | let _ = d(&1);
| ^^^^^^^^^^^^^^
|
help: consider adding a type annotation
--> $DIR/let_underscore_untyped.rs:39:10
--> $DIR/let_underscore_untyped.rs:53:10
|
LL | let _ = d(&1);
| ^
error: non-binding `let` without a type annotation
--> $DIR/let_underscore_untyped.rs:40:5
--> $DIR/let_underscore_untyped.rs:54:5
|
LL | let _ = e();
| ^^^^^^^^^^^^
|
help: consider adding a type annotation
--> $DIR/let_underscore_untyped.rs:40:10
--> $DIR/let_underscore_untyped.rs:54:10
|
LL | let _ = e();
| ^
error: non-binding `let` without a type annotation
--> $DIR/let_underscore_untyped.rs:41:5
--> $DIR/let_underscore_untyped.rs:55:5
|
LL | let _ = f();
| ^^^^^^^^^^^^
|
help: consider adding a type annotation
--> $DIR/let_underscore_untyped.rs:41:10
--> $DIR/let_underscore_untyped.rs:55:10
|
LL | let _ = f();
| ^