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 {
4040 if let ExprKind :: Assign ( lhs, rhs, _) = & expr. kind
4141 && !lhs. span . from_expansion ( )
4242 && !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)
4644 // 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+ {
5748 if let Some ( default_trait_id) = cx. tcx . get_diagnostic_item ( sym:: Default )
5849 && implements_trait ( cx, inner_ty, default_trait_id, & [ ] )
5950 && is_default_call ( cx, rhs)
You can’t perform that action at this time.
0 commit comments