@@ -22,13 +22,13 @@ use super::{DOUBLE_MUST_USE, MUST_USE_CANDIDATE, MUST_USE_UNIT};
2222
2323pub ( super ) fn check_item < ' tcx > ( cx : & LateContext < ' tcx > , item : & ' tcx hir:: Item < ' _ > ) {
2424 let attrs = cx. tcx . hir ( ) . attrs ( item. hir_id ( ) ) ;
25- let attr = cx. tcx . get_attr ( item. owner_id . to_def_id ( ) , sym:: must_use) ;
25+ let attr = cx. tcx . get_attr ( item. owner_id , sym:: must_use) ;
2626 if let hir:: ItemKind :: Fn ( ref sig, _generics, ref body_id) = item. kind {
2727 let is_public = cx. effective_visibilities . is_exported ( item. owner_id . def_id ) ;
2828 let fn_header_span = item. span . with_hi ( sig. decl . output . span ( ) . hi ( ) ) ;
2929 if let Some ( attr) = attr {
3030 check_needless_must_use ( cx, sig. decl , item. owner_id , item. span , fn_header_span, attr) ;
31- } else if is_public && !is_proc_macro ( cx . sess ( ) , attrs) && !attrs. iter ( ) . any ( |a| a. has_name ( sym:: no_mangle) ) {
31+ } else if is_public && !is_proc_macro ( attrs) && !attrs. iter ( ) . any ( |a| a. has_name ( sym:: no_mangle) ) {
3232 check_must_use_candidate (
3333 cx,
3434 sig. decl ,
@@ -47,13 +47,10 @@ pub(super) fn check_impl_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Imp
4747 let is_public = cx. effective_visibilities . is_exported ( item. owner_id . def_id ) ;
4848 let fn_header_span = item. span . with_hi ( sig. decl . output . span ( ) . hi ( ) ) ;
4949 let attrs = cx. tcx . hir ( ) . attrs ( item. hir_id ( ) ) ;
50- let attr = cx. tcx . get_attr ( item. owner_id . to_def_id ( ) , sym:: must_use) ;
50+ let attr = cx. tcx . get_attr ( item. owner_id , sym:: must_use) ;
5151 if let Some ( attr) = attr {
5252 check_needless_must_use ( cx, sig. decl , item. owner_id , item. span , fn_header_span, attr) ;
53- } else if is_public
54- && !is_proc_macro ( cx. sess ( ) , attrs)
55- && trait_ref_of_method ( cx, item. owner_id . def_id ) . is_none ( )
56- {
53+ } else if is_public && !is_proc_macro ( attrs) && trait_ref_of_method ( cx, item. owner_id . def_id ) . is_none ( ) {
5754 check_must_use_candidate (
5855 cx,
5956 sig. decl ,
@@ -73,12 +70,12 @@ pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Tr
7370 let fn_header_span = item. span . with_hi ( sig. decl . output . span ( ) . hi ( ) ) ;
7471
7572 let attrs = cx. tcx . hir ( ) . attrs ( item. hir_id ( ) ) ;
76- let attr = cx. tcx . get_attr ( item. owner_id . to_def_id ( ) , sym:: must_use) ;
73+ let attr = cx. tcx . get_attr ( item. owner_id , sym:: must_use) ;
7774 if let Some ( attr) = attr {
7875 check_needless_must_use ( cx, sig. decl , item. owner_id , item. span , fn_header_span, attr) ;
7976 } else if let hir:: TraitFn :: Provided ( eid) = * eid {
8077 let body = cx. tcx . hir ( ) . body ( eid) ;
81- if attr. is_none ( ) && is_public && !is_proc_macro ( cx . sess ( ) , attrs) {
78+ if attr. is_none ( ) && is_public && !is_proc_macro ( attrs) {
8279 check_must_use_candidate (
8380 cx,
8481 sig. decl ,
0 commit comments