-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.L-dead_codeLint: dead_codeLint: dead_codeT-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
Code
fn fun() {
extern "C" {
fn foo();
}
fn bar() {}
unsafe { foo(); }
bar();
}
Current output
warning: function `fun` is never used
--> src/lib.rs:1:4
|
1 | fn fun() {
| ^^^
|
= note: `#[warn(dead_code)]` on by default
warning: function `foo` is never used
--> src/lib.rs:3:12
|
3 | fn foo();
| ^^^
Desired output
warning: function `fun` is never used
--> src/lib.rs:1:4
|
1 | fn fun() {
| ^^^
|
= note: `#[warn(dead_code)]` on by default
Rationale and extra context
foo
's calling code already generates a dead code warning, so foo
itself should not generate another one, like bar
.
Other cases
No response
Anything else?
No response
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.L-dead_codeLint: dead_codeLint: dead_codeT-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.