]> git.lizzy.rs Git - rust.git/commitdiff
Use `has_attr` instead of `get_attrs` in `has_must_use_attr`
authorAaron Kofsky <aaronko@umich.edu>
Sun, 5 Jun 2022 00:16:56 +0000 (20:16 -0400)
committerAaron Kofsky <aaronko@umich.edu>
Sun, 5 Jun 2022 00:16:56 +0000 (20:16 -0400)
compiler/rustc_lint/src/let_underscore.rs

index c2d1cff313b871339f58efb24a4d598190631dfc..d33ea450b3e89cd8b4c1636c5124b50efdd715a4 100644 (file)
@@ -259,8 +259,5 @@ fn is_must_use_func_call(cx: &LateContext<'_>, expr: &hir::Expr<'_>) -> bool {
 
 // returns true if DefId contains a `#[must_use]` attribute
 fn has_must_use_attr(cx: &LateContext<'_>, did: hir::def_id::DefId) -> bool {
-    cx.tcx
-        .get_attrs(did, rustc_span::sym::must_use)
-        .find(|a| a.has_name(rustc_span::sym::must_use))
-        .is_some()
+    cx.tcx.has_attr(did, rustc_span::sym::must_use)
 }