@@ -12,7 +12,6 @@ use rustc_hir::HirId;
12
12
use rustc_hir:: intravisit:: { self , Visitor } ;
13
13
use rustc_lint:: { LateContext , LateLintPass } ;
14
14
use rustc_middle:: hir:: nested_filter;
15
- use rustc_middle:: ty;
16
15
use rustc_session:: impl_lint_pass;
17
16
use rustc_span:: Span ;
18
17
use rustc_span:: symbol:: Ident ;
@@ -109,11 +108,11 @@ fn find_slice_values(cx: &LateContext<'_>, pat: &hir::Pat<'_>) -> FxIndexMap<Hir
109
108
}
110
109
111
110
let bound_ty = cx. typeck_results ( ) . node_type ( pat. hir_id ) ;
112
- if let ty :: Slice ( inner_ty) | ty :: Array ( inner_ty , _ ) = bound_ty. peel_refs ( ) . kind ( ) {
111
+ if let Some ( inner_ty) = bound_ty. peel_refs ( ) . builtin_index ( ) {
113
112
// The values need to use the `ref` keyword if they can't be copied.
114
113
// This will need to be adjusted if the lint want to support mutable access in the future
115
114
let src_is_ref = bound_ty. is_ref ( ) && by_ref == hir:: ByRef :: No ;
116
- let needs_ref = !( src_is_ref || is_copy ( cx, * inner_ty) ) ;
115
+ let needs_ref = !( src_is_ref || is_copy ( cx, inner_ty) ) ;
117
116
118
117
let slice_info = slices
119
118
. entry ( value_hir_id)
0 commit comments