rust-lang / rust-lang/rust-clippy
The useless attribute lint doesn't put the ! in the right place.
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
When the useless_attribute lint is activated, it says that you most likely forgot an exclamation mark (!). While this is true, it also suggests to stick the ! in the middle of the attribute:
warning: useless lint attribute, #[warn(useless_attribute)] on by default
--> src/lib.rs:1:38
|
1 | #[cfg_attr(feature = "cargo-clippy", allow(new_without_default))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: if you just forgot a `!`, use
| #[cfg_attr(feature = "cargo-clippy", a!llow(new_without_default))]
= help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#useless_attribute
The correct response should be to suggest adding it after the #
I'm using the latest clippy on the latest nightly Rust.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the useless_attribute diagnostic from the issue using the cfg_attr example in src/lib.rs with the latest Clippy and Rust nightly. Trace the useless_attribute lint's help suggestion and update its reported insertion point so the ! is recommended after #; done when the diagnostic shows the corrected placement.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100