-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed as not planned
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
The following code:
fn foo(arg: i32) {
todo!()
}
fn main() {
foo(35);
}
Currently emits a warning:
warning: unused variable: `arg`
--> src/main.rs:1:8
|
1 | fn foo(arg: i32) {
| ^^^ help: if this is intentional, prefix it with an underscore: `_arg`
|
= note: `#[warn(unused_variables)]` on by default
warning: 1 warning emitted
But todo!()
clearly indicates that the argument is unused neither because it's intended to be ignored (in which case it'd be appropriate to rename it to _arg
), nor because the author forgot to use it — but simply because the relevant code to use it has not been written yet.
Since todo!()
itself does not trigger any warnings (meaning, rustc is fine with trying to compile code with parts that are explicitly not implemented yet), it doesn't seem appropriate to warn about unused variables that are "covered" by todo!()
.
charles-r-earp, Vlad-Shcherbina, ogoffart, Artemis21, TennyZhuang and 14 more
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.