Skip to content

"Generate Deref impl" should abbreviate std::ops::Deref if already in scope #12265

Closed
@jonas-schievink

Description

@jonas-schievink
use std::ops::Deref;

struct S {
    target$0: u8,
}

Applying the "Generate Deref impl using target" assist generates this:

impl std::ops::Deref for S {
    type Target = u8;

    fn deref(&self) -> &Self::Target {
        &self.target
    }
}

The std::ops::Deref is unnecessarily qualified here, just Deref would be enough. We have code that can automatically do this, should just be a matter of calling that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-assistsS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions