Skip to content

add attribute on impl and associated lint for "no default methods" #14220

Closed
@pnkfelix

Description

@pnkfelix

Default methods in traits are great.

But in some bodies of code, the client would prefer to actually handle each case themselves (e.g. if they want to add debug log instrumentation to each call).

Right now if Sally implements TraitFoo which lives in a different crate for StructBar, and then tomorrow someone else adds a new method with a default implementation to TraitFoo to the next version of that crate, Sally will get no warning that maybe she might want to add another method implementation to StructBar.

I think niko proposed to me when we discussed this (in the context of the Visitor in PR #14145) that we add a way for the client to ask for their impl to be linted, checking that every method the trait is overridden locally.

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