File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -40,20 +40,11 @@ impl LateLintPass<'_> for ReplaceBox {
40
40
if let ExprKind :: Assign ( lhs, rhs, _) = & expr. kind
41
41
&& !lhs. span . from_expansion ( )
42
42
&& !rhs. span . from_expansion ( )
43
- {
44
- let lhs_ty = cx. typeck_results ( ) . expr_ty ( lhs) ;
45
-
43
+ && let lhs_ty = cx. typeck_results ( ) . expr_ty ( lhs)
46
44
// No diagnostic for late-initialized locals
47
- if let Some ( local) = path_to_local ( lhs)
48
- && !local_is_initialized ( cx, local)
49
- {
50
- return ;
51
- }
52
-
53
- let Some ( inner_ty) = get_box_inner_type ( cx, lhs_ty) else {
54
- return ;
55
- } ;
56
-
45
+ && path_to_local ( lhs) . is_none_or ( |local| local_is_initialized ( cx, local) )
46
+ && let Some ( inner_ty) = get_box_inner_type ( cx, lhs_ty)
47
+ {
57
48
if let Some ( default_trait_id) = cx. tcx . get_diagnostic_item ( sym:: Default )
58
49
&& implements_trait ( cx, inner_ty, default_trait_id, & [ ] )
59
50
&& is_default_call ( cx, rhs)
You can’t perform that action at this time.
0 commit comments