File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -937,10 +937,11 @@ impl<'tcx> Delegate<'tcx> for DerefDelegate<'_, 'tcx> {
937
937
// note: unable to trigger `Subslice` kind in tests
938
938
ProjectionKind :: Subslice => ( ) ,
939
939
ProjectionKind :: Deref => {
940
- // explicit deref for arrays should be avoided in the suggestion
941
- // i.e.: `|sub| *sub[1..4].len() == 3` is not expected
940
+ // Explicit derefs are typically handled later on, but
941
+ // some items do not need explicit deref, such as array accesses,
942
+ // so we mark them as already processed
943
+ // i.e.: don't suggest `*sub[1..4].len()` for `|sub| sub[1..4].len() == 3`
942
944
if let ty:: Ref ( _, inner, _) = cmt. place . ty_before_projection ( i) . kind ( ) {
943
- // dereferencing an array (i.e.: `|sub| sub[1..4].len() == 3`)
944
945
if matches ! ( inner. kind( ) , ty:: Ref ( _, innermost, _) if innermost. is_array( ) ) {
945
946
projections_handled = true ;
946
947
}
You can’t perform that action at this time.
0 commit comments