-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
A-lintArea: New lintsArea: New lints
Description
What it does
we add #[allow(lint)]
to a function to suppress a lint, when that function's body changes and no longer raises that lint, we have the old #[allow(lint)]
annotation silently staying there
we might also add #[allow(lint)]
to a function because we're sure it will raise that lint, and we turn out to be wrong we dont realize we added that for no reason
Lint Name
unused_allow
Category
style
Advantage
- keeps code clean
- doesnt give the idea that the function raises the lint
- gives no hint to the history of a function
Drawbacks
we might wanna allow a lint to express that we dont care if this happens in the future, in which case we can also allow this lint to express that more explicitly
Example
say we think ignoring an error is fine
#[allow(unused_must_use)]
fn foo() {
let _: Result<_, _> = fallible();
}
then we realize we do need to handle the error so we rewrite the function to
#[allow(unused_must_use)]
fn foo() {
fallible().handle();
}
but here #[allow(unused_must_use)]
stays even tho it doesnt need to
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lints