@@ -13,13 +13,13 @@ use clippy_utils::attrs::is_proc_macro;
1313use clippy_utils:: diagnostics:: { span_lint_and_help, span_lint_and_then} ;
1414use clippy_utils:: source:: snippet_opt;
1515use 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} ;
1717
1818use super :: { DOUBLE_MUST_USE , MUST_USE_CANDIDATE , MUST_USE_UNIT } ;
1919
2020pub ( super ) fn check_item < ' tcx > ( cx : & LateContext < ' tcx > , item : & ' tcx hir:: Item < ' _ > ) {
2121 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 ) ;
2323 if let hir:: ItemKind :: Fn ( ref sig, _generics, ref body_id) = item. kind {
2424 let is_public = cx. access_levels . is_exported ( item. def_id ) ;
2525 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
4444 let is_public = cx. access_levels . is_exported ( item. def_id ) ;
4545 let fn_header_span = item. span . with_hi ( sig. decl . output . span ( ) . hi ( ) ) ;
4646 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 ) ;
4848 if let Some ( attr) = attr {
4949 check_needless_must_use ( cx, sig. decl , item. hir_id ( ) , item. span , fn_header_span, attr) ;
5050 } 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
6767 let fn_header_span = item. span . with_hi ( sig. decl . output . span ( ) . hi ( ) ) ;
6868
6969 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 ) ;
7171 if let Some ( attr) = attr {
7272 check_needless_must_use ( cx, sig. decl , item. hir_id ( ) , item. span , fn_header_span, attr) ;
7373 } else if let hir:: TraitFn :: Provided ( eid) = * eid {
0 commit comments