-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingT-macrosType: Issues with macros and macro expansionType: Issues with macros and macro expansion
Description
Code:
#![warn(clippy::must_use_candidate)]
extern crate proc_macro;
use proc_macro::TokenStream;
#[proc_macro]
pub fn proc_macro1(input: TokenStream) -> TokenStream { //~ WARN this function could have a `#[must_use]` attribute
input
}
#[proc_macro_attribute]
pub fn proc_macro2(_: TokenStream, input: TokenStream) -> TokenStream { //~ WARN this function could have a `#[must_use]` attribute
input
}
#[proc_macro_derive(Foo)]
pub fn proc_macro3(input: TokenStream) -> TokenStream { //~ WARN this function could have a `#[must_use]` attribute
input
}
Output
warning: this function could have a `#[must_use]` attribute
--> src/lib.rs:8:1
|
8 | pub fn proc_macro1(input: TokenStream) -> TokenStream {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn proc_macro1(input: TokenStream) -> TokenStream`
|
note: lint level defined here
--> src/lib.rs:1:9
|
1 | #![warn(clippy::must_use_candidate)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
warning: this function could have a `#[must_use]` attribute
--> src/lib.rs:13:1
|
13 | pub fn proc_macro2(_: TokenStream, input: TokenStream) -> TokenStream {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn proc_macro2(_: TokenStream, input: TokenStream) -> TokenStream`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
warning: this function could have a `#[must_use]` attribute
--> src/lib.rs:18:1
|
18 | pub fn proc_macro3(input: TokenStream) -> TokenStream {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn proc_macro3(input: TokenStream) -> TokenStream`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingT-macrosType: Issues with macros and macro expansionType: Issues with macros and macro expansion