@@ -168,7 +168,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
168168 // without the final expr (e.g. `try { return; }`). We don't want to generate an
169169 // unreachable_code lint for it since warnings for autogenerated code are confusing.
170170 let is_try_block_generated_unit_expr = match expr. kind {
171- ExprKind :: Call ( _, ref args) if expr. span . is_desugaring ( DesugaringKind :: TryBlock ) => {
171+ ExprKind :: Call ( _, args) if expr. span . is_desugaring ( DesugaringKind :: TryBlock ) => {
172172 args. len ( ) == 1 && args[ 0 ] . span . is_desugaring ( DesugaringKind :: TryBlock )
173173 }
174174
@@ -193,9 +193,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
193193 // diverging expression (e.g. it arose from desugaring of `try { return }`),
194194 // we skip issuing a warning because it is autogenerated code.
195195 ExprKind :: Call ( ..) if expr. span . is_desugaring ( DesugaringKind :: TryBlock ) => { }
196- ExprKind :: Call ( ref callee, _) => {
197- self . warn_if_unreachable ( expr. hir_id , callee. span , "call" )
198- }
196+ ExprKind :: Call ( callee, _) => self . warn_if_unreachable ( expr. hir_id , callee. span , "call" ) ,
199197 ExprKind :: MethodCall ( _, ref span, _, _) => {
200198 self . warn_if_unreachable ( expr. hir_id , * span, "call" )
201199 }
@@ -231,23 +229,23 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
231229
232230 let tcx = self . tcx ;
233231 match expr. kind {
234- ExprKind :: Box ( ref subexpr) => self . check_expr_box ( subexpr, expected) ,
232+ ExprKind :: Box ( subexpr) => self . check_expr_box ( subexpr, expected) ,
235233 ExprKind :: Lit ( ref lit) => self . check_lit ( & lit, expected) ,
236- ExprKind :: Binary ( op, ref lhs, ref rhs) => self . check_binop ( expr, op, lhs, rhs) ,
237- ExprKind :: Assign ( ref lhs, ref rhs, ref span) => {
234+ ExprKind :: Binary ( op, lhs, rhs) => self . check_binop ( expr, op, lhs, rhs) ,
235+ ExprKind :: Assign ( lhs, rhs, ref span) => {
238236 self . check_expr_assign ( expr, expected, lhs, rhs, span)
239237 }
240- ExprKind :: AssignOp ( op, ref lhs, ref rhs) => self . check_binop_assign ( expr, op, lhs, rhs) ,
241- ExprKind :: Unary ( unop, ref oprnd) => self . check_expr_unary ( unop, oprnd, expected, expr) ,
242- ExprKind :: AddrOf ( kind, mutbl, ref oprnd) => {
238+ ExprKind :: AssignOp ( op, lhs, rhs) => self . check_binop_assign ( expr, op, lhs, rhs) ,
239+ ExprKind :: Unary ( unop, oprnd) => self . check_expr_unary ( unop, oprnd, expected, expr) ,
240+ ExprKind :: AddrOf ( kind, mutbl, oprnd) => {
243241 self . check_expr_addr_of ( kind, mutbl, oprnd, expected, expr)
244242 }
245243 ExprKind :: Path ( QPath :: LangItem ( lang_item, _) ) => {
246244 self . check_lang_item_path ( lang_item, expr)
247245 }
248246 ExprKind :: Path ( ref qpath) => self . check_expr_path ( qpath, expr) ,
249247 ExprKind :: InlineAsm ( asm) => self . check_expr_asm ( asm) ,
250- ExprKind :: LlvmInlineAsm ( ref asm) => {
248+ ExprKind :: LlvmInlineAsm ( asm) => {
251249 for expr in asm. outputs_exprs . iter ( ) . chain ( asm. inputs_exprs . iter ( ) ) {
252250 self . check_expr ( expr) ;
253251 }
@@ -265,42 +263,42 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
265263 }
266264 }
267265 ExprKind :: Ret ( ref expr_opt) => self . check_expr_return ( expr_opt. as_deref ( ) , expr) ,
268- ExprKind :: Loop ( ref body, _, source, _) => {
266+ ExprKind :: Loop ( body, _, source, _) => {
269267 self . check_expr_loop ( body, source, expected, expr)
270268 }
271- ExprKind :: Match ( ref discrim, ref arms, match_src) => {
269+ ExprKind :: Match ( discrim, arms, match_src) => {
272270 self . check_match ( expr, & discrim, arms, expected, match_src)
273271 }
274- ExprKind :: Closure ( capture, ref decl, body_id, _, gen) => {
272+ ExprKind :: Closure ( capture, decl, body_id, _, gen) => {
275273 self . check_expr_closure ( expr, capture, & decl, body_id, gen, expected)
276274 }
277- ExprKind :: Block ( ref body, _) => self . check_block_with_expected ( & body, expected) ,
278- ExprKind :: Call ( ref callee, ref args) => self . check_call ( expr, & callee, args, expected) ,
279- ExprKind :: MethodCall ( ref segment, span, ref args, _) => {
275+ ExprKind :: Block ( body, _) => self . check_block_with_expected ( & body, expected) ,
276+ ExprKind :: Call ( callee, args) => self . check_call ( expr, & callee, args, expected) ,
277+ ExprKind :: MethodCall ( segment, span, args, _) => {
280278 self . check_method_call ( expr, segment, span, args, expected)
281279 }
282- ExprKind :: Cast ( ref e , ref t) => self . check_expr_cast ( e, t, expr) ,
283- ExprKind :: Type ( ref e , ref t) => {
280+ ExprKind :: Cast ( e , t) => self . check_expr_cast ( e, t, expr) ,
281+ ExprKind :: Type ( e , t) => {
284282 let ty = self . to_ty_saving_user_provided_ty ( & t) ;
285283 self . check_expr_eq_type ( & e, ty) ;
286284 ty
287285 }
288286 ExprKind :: If ( cond, then_expr, opt_else_expr) => {
289287 self . check_then_else ( cond, then_expr, opt_else_expr, expr. span , expected)
290288 }
291- ExprKind :: DropTemps ( ref e) => self . check_expr_with_expectation ( e, expected) ,
292- ExprKind :: Array ( ref args) => self . check_expr_array ( args, expected, expr) ,
289+ ExprKind :: DropTemps ( e) => self . check_expr_with_expectation ( e, expected) ,
290+ ExprKind :: Array ( args) => self . check_expr_array ( args, expected, expr) ,
293291 ExprKind :: ConstBlock ( ref anon_const) => self . to_const ( anon_const) . ty ,
294- ExprKind :: Repeat ( ref element, ref count) => {
292+ ExprKind :: Repeat ( element, ref count) => {
295293 self . check_expr_repeat ( element, count, expected, expr)
296294 }
297- ExprKind :: Tup ( ref elts) => self . check_expr_tuple ( elts, expected, expr) ,
298- ExprKind :: Struct ( ref qpath, fields, ref base_expr) => {
295+ ExprKind :: Tup ( elts) => self . check_expr_tuple ( elts, expected, expr) ,
296+ ExprKind :: Struct ( qpath, fields, ref base_expr) => {
299297 self . check_expr_struct ( expr, expected, qpath, fields, base_expr)
300298 }
301- ExprKind :: Field ( ref base, field) => self . check_field ( expr, & base, field) ,
302- ExprKind :: Index ( ref base, ref idx) => self . check_expr_index ( base, idx, expr) ,
303- ExprKind :: Yield ( ref value, ref src) => self . check_expr_yield ( value, expr, src) ,
299+ ExprKind :: Field ( base, field) => self . check_field ( expr, & base, field) ,
300+ ExprKind :: Index ( base, idx) => self . check_expr_index ( base, idx, expr) ,
301+ ExprKind :: Yield ( value, ref src) => self . check_expr_yield ( value, expr, src) ,
304302 hir:: ExprKind :: Err => tcx. ty_error ( ) ,
305303 }
306304 }
@@ -541,7 +539,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
541539 let tcx = self . tcx ;
542540 if let Ok ( target_id) = destination. target_id {
543541 let ( e_ty, cause) ;
544- if let Some ( ref e) = expr_opt {
542+ if let Some ( e) = expr_opt {
545543 // If this is a break with a value, we need to type-check
546544 // the expression. Get an expected type from the loop context.
547545 let opt_coerce_to = {
@@ -650,12 +648,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
650648
651649 // We still need to assign a type to the inner expression to
652650 // prevent the ICE in #43162.
653- if let Some ( ref e) = expr_opt {
651+ if let Some ( e) = expr_opt {
654652 self . check_expr_with_hint ( e, err) ;
655653
656654 // ... except when we try to 'break rust;'.
657655 // ICE this expression in particular (see #43162).
658- if let ExprKind :: Path ( QPath :: Resolved ( _, ref path) ) = e. kind {
656+ if let ExprKind :: Path ( QPath :: Resolved ( _, path) ) = e. kind {
659657 if path. segments . len ( ) == 1 && path. segments [ 0 ] . ident . name == sym:: rust {
660658 fatally_break_rust ( self . tcx . sess ) ;
661659 }
@@ -674,7 +672,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
674672 ) -> Ty < ' tcx > {
675673 if self . ret_coercion . is_none ( ) {
676674 self . tcx . sess . emit_err ( ReturnStmtOutsideOfFnBody { span : expr. span } ) ;
677- } else if let Some ( ref e) = expr_opt {
675+ } else if let Some ( e) = expr_opt {
678676 if self . ret_coercion_span . get ( ) . is_none ( ) {
679677 self . ret_coercion_span . set ( Some ( e. span ) ) ;
680678 }
@@ -1133,13 +1131,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11331131 let flds = expected. only_has_type ( self ) . and_then ( |ty| {
11341132 let ty = self . resolve_vars_with_obligations ( ty) ;
11351133 match ty. kind ( ) {
1136- ty:: Tuple ( ref flds) => Some ( & flds[ ..] ) ,
1134+ ty:: Tuple ( flds) => Some ( & flds[ ..] ) ,
11371135 _ => None ,
11381136 }
11391137 } ) ;
11401138
11411139 let elt_ts_iter = elts. iter ( ) . enumerate ( ) . map ( |( i, e) | match flds {
1142- Some ( ref fs) if i < fs. len ( ) => {
1140+ Some ( fs) if i < fs. len ( ) => {
11431141 let ety = fs[ i] . expect_ty ( ) ;
11441142 self . check_expr_coercable_to_type ( & e, ety, None ) ;
11451143 ety
@@ -1328,7 +1326,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13281326 for field in fields {
13291327 self . check_expr ( & field. expr ) ;
13301328 }
1331- if let Some ( ref base) = * base_expr {
1329+ if let Some ( base) = * base_expr {
13321330 self . check_expr ( & base) ;
13331331 }
13341332 }
@@ -1488,7 +1486,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
14881486 } ,
14891487 _ => {
14901488 // prevent all specified fields from being suggested
1491- let skip_fields = skip_fields. iter ( ) . map ( |ref x| x. ident . name ) ;
1489+ let skip_fields = skip_fields. iter ( ) . map ( |x| x. ident . name ) ;
14921490 if let Some ( field_name) =
14931491 Self :: suggest_field_name ( variant, field. ident . name , skip_fields. collect ( ) )
14941492 {
@@ -1617,7 +1615,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
16171615 private_candidate = Some ( ( base_def. did , field_ty) ) ;
16181616 }
16191617 }
1620- ty:: Tuple ( ref tys) => {
1618+ ty:: Tuple ( tys) => {
16211619 let fstr = field. as_str ( ) ;
16221620 if let Ok ( index) = fstr. parse :: < usize > ( ) {
16231621 if fstr == index. to_string ( ) {
0 commit comments