@@ -276,10 +276,13 @@ impl UnusedParens {
276276                                cx :  & EarlyContext , 
277277                                value :  & ast:: Expr , 
278278                                msg :  & str , 
279-                                 struct_lit_needs_parens :  bool )  { 
279+                                 followed_by_block :  bool )  { 
280280        if  let  ast:: ExprKind :: Paren ( ref  inner)  = value. node  { 
281-             let  necessary = struct_lit_needs_parens &&
282-                             parser:: contains_exterior_struct_lit ( & inner) ; 
281+             let  necessary = followed_by_block && if  let  ast:: ExprKind :: Ret ( _)  = inner. node  { 
282+                 true 
283+             }  else  { 
284+                 parser:: contains_exterior_struct_lit ( & inner) 
285+             } ; 
283286            if  !necessary { 
284287                let  pattern = pprust:: expr_to_string ( value) ; 
285288                Self :: remove_outer_parens ( cx,  value. span ,  & pattern,  msg) ; 
@@ -343,7 +346,7 @@ impl LintPass for UnusedParens {
343346impl  EarlyLintPass  for  UnusedParens  { 
344347    fn  check_expr ( & mut  self ,  cx :  & EarlyContext ,  e :  & ast:: Expr )  { 
345348        use  syntax:: ast:: ExprKind :: * ; 
346-         let  ( value,  msg,  struct_lit_needs_parens )  = match  e. node  { 
349+         let  ( value,  msg,  followed_by_block )  = match  e. node  { 
347350            If ( ref  cond,  ..)  => ( cond,  "`if` condition" ,  true ) , 
348351            While ( ref  cond,  ..)  => ( cond,  "`while` condition" ,  true ) , 
349352            IfLet ( _,  ref  cond,  ..)  => ( cond,  "`if let` head expression" ,  true ) , 
@@ -380,7 +383,7 @@ impl EarlyLintPass for UnusedParens {
380383                return ; 
381384            } 
382385        } ; 
383-         self . check_unused_parens_expr ( cx,  & value,  msg,  struct_lit_needs_parens ) ; 
386+         self . check_unused_parens_expr ( cx,  & value,  msg,  followed_by_block ) ; 
384387    } 
385388
386389    fn  check_pat ( & mut  self ,  cx :  & EarlyContext ,  p :  & ast:: Pat )  { 
0 commit comments