@@ -263,7 +263,8 @@ impl<'a, 'tcx> VarVisitor<'a, 'tcx> {
263
263
match res {
264
264
Res :: Local ( hir_id) => {
265
265
let parent_def_id = self . cx. tcx. hir( ) . get_parent_item( expr. hir_id) ;
266
- let extent = self . cx
266
+ let extent = self
267
+ . cx
267
268
. tcx
268
269
. region_scope_tree( parent_def_id)
269
270
. var_scope( hir_id. local_id)
@@ -274,11 +275,12 @@ impl<'a, 'tcx> VarVisitor<'a, 'tcx> {
274
275
( Some ( extent) , self . cx. typeck_results( ) . node_type( seqexpr. hir_id) ) ,
275
276
) ;
276
277
} else {
277
- self . indexed_indirectly. insert( seqvar. segments[ 0 ] . ident. name, Some ( extent) ) ;
278
+ self . indexed_indirectly
279
+ . insert( seqvar. segments[ 0 ] . ident. name, Some ( extent) ) ;
278
280
}
279
- return false ; // no need to walk further *on the variable*
280
- }
281
- Res :: Def ( DefKind :: Static ( _) | DefKind :: Const , ..) => {
281
+ return false ; // no need to walk further *on the variable*
282
+ } ,
283
+ Res :: Def ( DefKind :: Static ( _) | DefKind :: Const , ..) => {
282
284
if index_used_directly {
283
285
self . indexed_directly. insert(
284
286
seqvar. segments[ 0 ] . ident. name,
@@ -287,8 +289,8 @@ impl<'a, 'tcx> VarVisitor<'a, 'tcx> {
287
289
} else {
288
290
self . indexed_indirectly. insert( seqvar. segments[ 0 ] . ident. name, None ) ;
289
291
}
290
- return false ; // no need to walk further *on the variable*
291
- }
292
+ return false ; // no need to walk further *on the variable*
293
+ } ,
292
294
_ => ( ) ,
293
295
}
294
296
}
@@ -310,14 +312,18 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
310
312
if ( meth. ident. name == sym:: index && trait_id == self . cx. tcx. lang_items( ) . index_trait( ) )
311
313
|| ( meth. ident. name == sym:: index_mut && trait_id == self . cx. tcx. lang_items( ) . index_mut_trait( ) ) ;
312
314
if !self . check( args_1, args_0, expr) ;
313
- then { return }
315
+ then {
316
+ return ;
317
+ }
314
318
}
315
319
316
320
if_chain ! {
317
321
// an index op
318
322
if let ExprKind :: Index ( seqexpr, idx) = expr. kind;
319
323
if !self . check( idx, seqexpr, expr) ;
320
- then { return }
324
+ then {
325
+ return ;
326
+ }
321
327
}
322
328
323
329
if_chain ! {
0 commit comments