Use has_attr
instead of get_attrs
in has_must_use_attr
This commit is contained in:
parent
1421cffca1
commit
30e8adb1a7
1 changed files with 1 additions and 4 deletions
|
@ -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
|
// returns true if DefId contains a `#[must_use]` attribute
|
||||||
fn has_must_use_attr(cx: &LateContext<'_>, did: hir::def_id::DefId) -> bool {
|
fn has_must_use_attr(cx: &LateContext<'_>, did: hir::def_id::DefId) -> bool {
|
||||||
cx.tcx
|
cx.tcx.has_attr(did, rustc_span::sym::must_use)
|
||||||
.get_attrs(did, rustc_span::sym::must_use)
|
|
||||||
.find(|a| a.has_name(rustc_span::sym::must_use))
|
|
||||||
.is_some()
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue