Skip to content

dead_code warnings for functions/types used in a unused function #39531

Open
@KalitaAlexey

Description

@KalitaAlexey

Hi everybody.
Playground
Code:

fn foo() {}
fn bar() {
    foo();
}
fn main() {}

Output:

warning: function is never used: `foo`, #[warn(dead_code)] on by default
 --> <anon>:1:1
  |
1 |   fn foo() {
  |  _^ starting here...
2 | |     
3 | | }
  | |_^ ...ending here

warning: function is never used: `bar`, #[warn(dead_code)] on by default
 --> <anon>:5:1
  |
5 |   fn bar() {
  |  _^ starting here...
6 | |     foo();
7 | | }
  | |_^ ...ending here

I don't like it because it confuses what exactly isn't used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.I-needs-decisionIssue: In need of a decision.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions