@@ -65,9 +65,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
65
65
ty:: Adt ( def, _) => {
66
66
if def. variants . is_empty ( ) {
67
67
return ;
68
- } else {
69
- check_must_use ( cx, def. did , s. span , "" )
70
68
}
69
+ check_must_use ( cx, def. did , s. span , "" )
71
70
} ,
72
71
_ => false ,
73
72
} ;
@@ -337,21 +336,13 @@ impl EarlyLintPass for UnusedParens {
337
336
AssignOp ( .., ref value) => ( value, "assigned value" , false ) ,
338
337
// either function/method call, or something this lint doesn't care about
339
338
ref call_or_other => {
340
- let args_to_check;
341
- let call_kind;
342
- match * call_or_other {
343
- Call ( _, ref args) => {
344
- call_kind = "function" ;
345
- args_to_check = & args[ ..] ;
346
- } ,
347
- MethodCall ( _, ref args) => {
348
- call_kind = "method" ;
349
- // first "argument" is self (which sometimes needs parens)
350
- args_to_check = & args[ 1 ..] ;
351
- }
339
+ let ( args_to_check, call_kind) = match * call_or_other {
340
+ Call ( _, ref args) => ( & args[ ..] , "function" ) ,
341
+ // first "argument" is self (which sometimes needs parens)
342
+ MethodCall ( _, ref args) => ( & args[ 1 ..] , "method" ) ,
352
343
// actual catch-all arm
353
344
_ => { return ; }
354
- }
345
+ } ;
355
346
// Don't lint if this is a nested macro expansion: otherwise, the lint could
356
347
// trigger in situations that macro authors shouldn't have to care about, e.g.,
357
348
// when a parenthesized token tree matched in one macro expansion is matched as
@@ -372,16 +363,11 @@ impl EarlyLintPass for UnusedParens {
372
363
}
373
364
374
365
fn check_stmt ( & mut self , cx : & EarlyContext , s : & ast:: Stmt ) {
375
- let ( value, msg) = match s. node {
376
- ast:: StmtKind :: Local ( ref local) => {
377
- match local. init {
378
- Some ( ref value) => ( value, "assigned value" ) ,
379
- None => return ,
380
- }
366
+ if let ast:: StmtKind :: Local ( ref local) = s. node {
367
+ if let Some ( ref value) = local. init {
368
+ self . check_unused_parens_core ( cx, & value, "assigned value" , false ) ;
381
369
}
382
- _ => return ,
383
- } ;
384
- self . check_unused_parens_core ( cx, & value, msg, false ) ;
370
+ }
385
371
}
386
372
}
387
373
@@ -414,9 +400,8 @@ impl UnusedImportBraces {
414
400
let orig_ident = items[ 0 ] . 0 . prefix . segments . last ( ) . unwrap ( ) . ident ;
415
401
if orig_ident. name == keywords:: SelfValue . name ( ) {
416
402
return ;
417
- } else {
418
- node_ident = rename. unwrap_or ( orig_ident) ;
419
403
}
404
+ node_ident = rename. unwrap_or ( orig_ident) ;
420
405
}
421
406
ast:: UseTreeKind :: Glob => {
422
407
node_ident = ast:: Ident :: from_str ( "*" ) ;
0 commit comments