Skip to content

new_ret_no_self false positive when returning impl Trait<Self> #7344

Closed
@nbdd0121

Description

@nbdd0121

Lint name: new_ret_no_self

pub struct Foo;

impl Foo {
    pub fn new() -> impl Into<Self> {
        Foo
    }
}

causes a warning where it shouldn't. impl Into here can be any trait that has Self in generic arguments.

This is similar to #4359 but instead of Future<Output = Self> it's Into<Self>. #4365's title implies that this should be allowed but actually it only deals with associated types, not type parameters.

cargo clippy -V: 0.1.54 (2021-06-09 eab201d)

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions