@@ -13,13 +13,13 @@ use clippy_utils::attrs::is_proc_macro;
13
13
use clippy_utils:: diagnostics:: { span_lint_and_help, span_lint_and_then} ;
14
14
use clippy_utils:: source:: snippet_opt;
15
15
use clippy_utils:: ty:: is_must_use_ty;
16
- use clippy_utils:: { match_def_path, must_use_attr , return_ty, trait_ref_of_method} ;
16
+ use clippy_utils:: { match_def_path, return_ty, trait_ref_of_method} ;
17
17
18
18
use super :: { DOUBLE_MUST_USE , MUST_USE_CANDIDATE , MUST_USE_UNIT } ;
19
19
20
20
pub ( super ) fn check_item < ' tcx > ( cx : & LateContext < ' tcx > , item : & ' tcx hir:: Item < ' _ > ) {
21
21
let attrs = cx. tcx . hir ( ) . attrs ( item. hir_id ( ) ) ;
22
- let attr = must_use_attr ( attrs ) ;
22
+ let attr = cx . tcx . get_attr ( item . def_id . to_def_id ( ) , sym :: must_use ) ;
23
23
if let hir:: ItemKind :: Fn ( ref sig, _generics, ref body_id) = item. kind {
24
24
let is_public = cx. access_levels . is_exported ( item. def_id ) ;
25
25
let fn_header_span = item. span . with_hi ( sig. decl . output . span ( ) . hi ( ) ) ;
@@ -44,7 +44,7 @@ pub(super) fn check_impl_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Imp
44
44
let is_public = cx. access_levels . is_exported ( item. def_id ) ;
45
45
let fn_header_span = item. span . with_hi ( sig. decl . output . span ( ) . hi ( ) ) ;
46
46
let attrs = cx. tcx . hir ( ) . attrs ( item. hir_id ( ) ) ;
47
- let attr = must_use_attr ( attrs ) ;
47
+ let attr = cx . tcx . get_attr ( item . def_id . to_def_id ( ) , sym :: must_use ) ;
48
48
if let Some ( attr) = attr {
49
49
check_needless_must_use ( cx, sig. decl , item. hir_id ( ) , item. span , fn_header_span, attr) ;
50
50
} else if is_public && !is_proc_macro ( cx. sess ( ) , attrs) && trait_ref_of_method ( cx, item. def_id ) . is_none ( ) {
@@ -67,7 +67,7 @@ pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Tr
67
67
let fn_header_span = item. span . with_hi ( sig. decl . output . span ( ) . hi ( ) ) ;
68
68
69
69
let attrs = cx. tcx . hir ( ) . attrs ( item. hir_id ( ) ) ;
70
- let attr = must_use_attr ( attrs ) ;
70
+ let attr = cx . tcx . get_attr ( item . def_id . to_def_id ( ) , sym :: must_use ) ;
71
71
if let Some ( attr) = attr {
72
72
check_needless_must_use ( cx, sig. decl , item. hir_id ( ) , item. span , fn_header_span, attr) ;
73
73
} else if let hir:: TraitFn :: Provided ( eid) = * eid {
0 commit comments