Skip to content

unused_variables lint shouldn't warn for unused parameter to default method in trait #26487

Closed
@sfackler

Description

@sfackler
trait Foo {
    fn bar(&self, a: i32) {}
}

fn main() {}
<anon>:2:19: 2:20 warning: unused variable: `a`, #[warn(unused_variables)] on by default
<anon>:2     fn bar(&self, a: i32) {}
                           ^

The arguments to default methods in traits form part of the documentation, but it is not uncommon for a default implementation of a method to be a no-op that uses none of its arguments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions