4

Don't emit RETURN_SELF_NOT_MUST_USE lint if `Self` already is marked as `#[must_...

 2 years ago
source link: https://github.com/rust-lang/rust-clippy/pull/8146
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Member

xFrednet left a comment

One small question, it otherwise looks good to me

@@ -50,6 +51,7 @@ fn check_method(cx: &LateContext<'tcx>, decl: &'tcx FnDecl<'tcx>, fn_def: LocalD

if decl.implicit_self.has_implicit_self();

// We only show this warning for public exported methods.

if cx.access_levels.is_exported(fn_def);

if !cx.tcx.hir().attrs(hir_id).iter().any(|attr| attr.has_name(sym::must_use));

Isn't this case covered by the must_use_attr check in line 57?

Indeed but apparently it's not working as it should. I'll clean up though. Good catch!

(Which was fixed in #8143 but I realized it would be better checked here instead.)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK