@@ -21,7 +21,7 @@ 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
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
- let is_public = cx. access_levels . is_exported ( item. def_id ) ;
24
+ let is_public = cx. access_levels . is_exported ( item. def_id . def_id ) ;
25
25
let fn_header_span = item. span . with_hi ( sig. decl . output . span ( ) . hi ( ) ) ;
26
26
if let Some ( attr) = attr {
27
27
check_needless_must_use ( cx, sig. decl , item. hir_id ( ) , item. span , fn_header_span, attr) ;
@@ -31,7 +31,7 @@ pub(super) fn check_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>
31
31
sig. decl ,
32
32
cx. tcx . hir ( ) . body ( * body_id) ,
33
33
item. span ,
34
- item. def_id ,
34
+ item. def_id . def_id ,
35
35
item. span . with_hi ( sig. decl . output . span ( ) . hi ( ) ) ,
36
36
"this function could have a `#[must_use]` attribute" ,
37
37
) ;
@@ -41,19 +41,20 @@ pub(super) fn check_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>
41
41
42
42
pub ( super ) fn check_impl_item < ' tcx > ( cx : & LateContext < ' tcx > , item : & ' tcx hir:: ImplItem < ' _ > ) {
43
43
if let hir:: ImplItemKind :: Fn ( ref sig, ref body_id) = item. kind {
44
- let is_public = cx. access_levels . is_exported ( item. def_id ) ;
44
+ let is_public = cx. access_levels . is_exported ( item. def_id . 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
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
- } else if is_public && !is_proc_macro ( cx. sess ( ) , attrs) && trait_ref_of_method ( cx, item. def_id ) . is_none ( ) {
50
+ } else if is_public && !is_proc_macro ( cx. sess ( ) , attrs) && trait_ref_of_method ( cx, item. def_id . def_id ) . is_none ( )
51
+ {
51
52
check_must_use_candidate (
52
53
cx,
53
54
sig. decl ,
54
55
cx. tcx . hir ( ) . body ( * body_id) ,
55
56
item. span ,
56
- item. def_id ,
57
+ item. def_id . def_id ,
57
58
item. span . with_hi ( sig. decl . output . span ( ) . hi ( ) ) ,
58
59
"this method could have a `#[must_use]` attribute" ,
59
60
) ;
@@ -63,7 +64,7 @@ pub(super) fn check_impl_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Imp
63
64
64
65
pub ( super ) fn check_trait_item < ' tcx > ( cx : & LateContext < ' tcx > , item : & ' tcx hir:: TraitItem < ' _ > ) {
65
66
if let hir:: TraitItemKind :: Fn ( ref sig, ref eid) = item. kind {
66
- let is_public = cx. access_levels . is_exported ( item. def_id ) ;
67
+ let is_public = cx. access_levels . is_exported ( item. def_id . def_id ) ;
67
68
let fn_header_span = item. span . with_hi ( sig. decl . output . span ( ) . hi ( ) ) ;
68
69
69
70
let attrs = cx. tcx . hir ( ) . attrs ( item. hir_id ( ) ) ;
@@ -78,7 +79,7 @@ pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Tr
78
79
sig. decl ,
79
80
body,
80
81
item. span ,
81
- item. def_id ,
82
+ item. def_id . def_id ,
82
83
item. span . with_hi ( sig. decl . output . span ( ) . hi ( ) ) ,
83
84
"this method could have a `#[must_use]` attribute" ,
84
85
) ;
@@ -171,7 +172,7 @@ fn is_mutable_pat(cx: &LateContext<'_>, pat: &hir::Pat<'_>, tys: &mut DefIdSet)
171
172
return false ; // ignore `_` patterns
172
173
}
173
174
if cx. tcx . has_typeck_results ( pat. hir_id . owner . to_def_id ( ) ) {
174
- is_mutable_ty ( cx, cx. tcx . typeck ( pat. hir_id . owner ) . pat_ty ( pat) , pat. span , tys)
175
+ is_mutable_ty ( cx, cx. tcx . typeck ( pat. hir_id . owner . def_id ) . pat_ty ( pat) , pat. span , tys)
175
176
} else {
176
177
false
177
178
}
@@ -218,7 +219,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for StaticMutVisitor<'a, 'tcx> {
218
219
if self . cx . tcx . has_typeck_results ( arg. hir_id . owner . to_def_id ( ) )
219
220
&& is_mutable_ty (
220
221
self . cx ,
221
- self . cx . tcx . typeck ( arg. hir_id . owner ) . expr_ty ( arg) ,
222
+ self . cx . tcx . typeck ( arg. hir_id . owner . def_id ) . expr_ty ( arg) ,
222
223
arg. span ,
223
224
& mut tys,
224
225
)
@@ -236,7 +237,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for StaticMutVisitor<'a, 'tcx> {
236
237
if self . cx . tcx . has_typeck_results ( arg. hir_id . owner . to_def_id ( ) )
237
238
&& is_mutable_ty (
238
239
self . cx ,
239
- self . cx . tcx . typeck ( arg. hir_id . owner ) . expr_ty ( arg) ,
240
+ self . cx . tcx . typeck ( arg. hir_id . owner . def_id ) . expr_ty ( arg) ,
240
241
arg. span ,
241
242
& mut tys,
242
243
)
0 commit comments