@@ -22,13 +22,13 @@ use super::{DOUBLE_MUST_USE, MUST_USE_CANDIDATE, MUST_USE_UNIT};
22
22
23
23
pub ( super ) fn check_item < ' tcx > ( cx : & LateContext < ' tcx > , item : & ' tcx hir:: Item < ' _ > ) {
24
24
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) ;
26
26
if let hir:: ItemKind :: Fn ( ref sig, _generics, ref body_id) = item. kind {
27
27
let is_public = cx. effective_visibilities . is_exported ( item. owner_id . def_id ) ;
28
28
let fn_header_span = item. span . with_hi ( sig. decl . output . span ( ) . hi ( ) ) ;
29
29
if let Some ( attr) = attr {
30
30
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) ) {
32
32
check_must_use_candidate (
33
33
cx,
34
34
sig. decl ,
@@ -47,13 +47,10 @@ pub(super) fn check_impl_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Imp
47
47
let is_public = cx. effective_visibilities . is_exported ( item. owner_id . def_id ) ;
48
48
let fn_header_span = item. span . with_hi ( sig. decl . output . span ( ) . hi ( ) ) ;
49
49
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) ;
51
51
if let Some ( attr) = attr {
52
52
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 ( ) {
57
54
check_must_use_candidate (
58
55
cx,
59
56
sig. decl ,
@@ -73,12 +70,12 @@ pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Tr
73
70
let fn_header_span = item. span . with_hi ( sig. decl . output . span ( ) . hi ( ) ) ;
74
71
75
72
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) ;
77
74
if let Some ( attr) = attr {
78
75
check_needless_must_use ( cx, sig. decl , item. owner_id , item. span , fn_header_span, attr) ;
79
76
} else if let hir:: TraitFn :: Provided ( eid) = * eid {
80
77
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) {
82
79
check_must_use_candidate (
83
80
cx,
84
81
sig. decl ,
0 commit comments