new_ret_no_self false positive when returning impl Trait<Self> · Issue #7344 · rust-lang/rust-clippy (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@nbdd0121

Description

@nbdd0121

Lint name: new_ret_no_self

pub struct Foo;

impl Foo { pub fn new() -> impl Into { 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)