@@ -110,7 +110,7 @@ fn is_unrooted_ty(sym: &Symbols, cx: &LateContext, ty: &ty::TyS, in_new_function
110
110
continue ;
111
111
} ,
112
112
} ;
113
- let recur_into_subtree = match t. kind {
113
+ let recur_into_subtree = match t. kind ( ) {
114
114
ty:: Adt ( did, substs) => {
115
115
let has_attr = |did, name| has_lint_attr ( sym, & cx. tcx . get_attrs ( did) , name) ;
116
116
if has_attr ( did. did , sym. must_root ) {
@@ -121,7 +121,7 @@ fn is_unrooted_ty(sym: &Symbols, cx: &LateContext, ty: &ty::TyS, in_new_function
121
121
} else if match_def_path ( cx, did. did , & [ sym. alloc , sym. rc , sym. Rc ] ) {
122
122
// Rc<Promise> is okay
123
123
let inner = substs. type_at ( 0 ) ;
124
- if let ty:: Adt ( did, _) = inner. kind {
124
+ if let ty:: Adt ( did, _) = inner. kind ( ) {
125
125
if has_attr ( did. did , sym. allow_unrooted_in_rc ) {
126
126
false
127
127
} else {
@@ -132,8 +132,12 @@ fn is_unrooted_ty(sym: &Symbols, cx: &LateContext, ty: &ty::TyS, in_new_function
132
132
}
133
133
} else if match_def_path ( cx, did. did , & [ sym:: core, sym. cell , sym. Ref ] ) ||
134
134
match_def_path ( cx, did. did , & [ sym:: core, sym. cell , sym. RefMut ] ) ||
135
- match_def_path ( cx, did. did , & [ sym:: core, sym. slice , sym. Iter ] ) ||
136
- match_def_path ( cx, did. did , & [ sym:: core, sym. slice , sym. IterMut ] ) ||
135
+ match_def_path ( cx, did. did , & [ sym:: core, sym:: slice, sym:: iter, sym. Iter ] ) ||
136
+ match_def_path (
137
+ cx,
138
+ did. did ,
139
+ & [ sym:: core, sym:: slice, sym:: iter, sym. IterMut ] ,
140
+ ) ||
137
141
match_def_path ( cx, did. did , & [ sym. accountable_refcell , sym. Ref ] ) ||
138
142
match_def_path ( cx, did. did , & [ sym. accountable_refcell , sym. RefMut ] ) ||
139
143
match_def_path (
@@ -383,13 +387,14 @@ impl<'a, 'tcx> visit::Visitor<'tcx> for FnDefVisitor<'a, 'tcx> {
383
387
/// usage e.g. with
384
388
/// `match_def_path(cx, id, &["core", "option", "Option"])`
385
389
fn match_def_path ( cx : & LateContext , def_id : DefId , path : & [ Symbol ] ) -> bool {
386
- let krate = & cx. tcx . crate_name ( def_id. krate ) ;
390
+ let def_path = cx. tcx . def_path ( def_id) ;
391
+ let krate = & cx. tcx . crate_name ( def_path. krate ) ;
387
392
if krate != & path[ 0 ] {
388
393
return false ;
389
394
}
390
395
391
396
let path = & path[ 1 ..] ;
392
- let other = cx . tcx . def_path ( def_id ) . data ;
397
+ let other = def_path. data ;
393
398
394
399
if other. len ( ) != path. len ( ) {
395
400
return false ;
@@ -398,7 +403,7 @@ fn match_def_path(cx: &LateContext, def_id: DefId, path: &[Symbol]) -> bool {
398
403
other
399
404
. into_iter ( )
400
405
. zip ( path)
401
- . all ( |( e, p) | e. data . as_symbol ( ) == * p )
406
+ . all ( |( e, p) | e. data . get_opt_name ( ) . as_ref ( ) == Some ( p ) )
402
407
}
403
408
404
409
fn in_derive_expn ( span : Span ) -> bool {
@@ -438,7 +443,6 @@ symbols! {
438
443
accountable_refcell
439
444
Ref
440
445
RefMut
441
- slice
442
446
Iter
443
447
IterMut
444
448
collections
0 commit comments