Format all the let chains in compiler
This commit is contained in:
parent
2763ca50da
commit
b2d2184ede
206 changed files with 3120 additions and 2228 deletions
|
@ -149,18 +149,37 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless {
|
|||
let drop_is_single_call_in_arm = is_single_call_in_arm(cx, arg, expr);
|
||||
match fn_name {
|
||||
sym::mem_drop if arg_ty.is_ref() && !drop_is_single_call_in_arm => {
|
||||
cx.emit_spanned_lint(DROPPING_REFERENCES, expr.span, DropRefDiag { arg_ty, label: arg.span });
|
||||
},
|
||||
cx.emit_spanned_lint(
|
||||
DROPPING_REFERENCES,
|
||||
expr.span,
|
||||
DropRefDiag { arg_ty, label: arg.span },
|
||||
);
|
||||
}
|
||||
sym::mem_forget if arg_ty.is_ref() => {
|
||||
cx.emit_spanned_lint(FORGETTING_REFERENCES, expr.span, ForgetRefDiag { arg_ty, label: arg.span });
|
||||
},
|
||||
cx.emit_spanned_lint(
|
||||
FORGETTING_REFERENCES,
|
||||
expr.span,
|
||||
ForgetRefDiag { arg_ty, label: arg.span },
|
||||
);
|
||||
}
|
||||
sym::mem_drop if is_copy && !drop_is_single_call_in_arm => {
|
||||
cx.emit_spanned_lint(DROPPING_COPY_TYPES, expr.span, DropCopyDiag { arg_ty, label: arg.span });
|
||||
cx.emit_spanned_lint(
|
||||
DROPPING_COPY_TYPES,
|
||||
expr.span,
|
||||
DropCopyDiag { arg_ty, label: arg.span },
|
||||
);
|
||||
}
|
||||
sym::mem_forget if is_copy => {
|
||||
cx.emit_spanned_lint(FORGETTING_COPY_TYPES, expr.span, ForgetCopyDiag { arg_ty, label: arg.span });
|
||||
cx.emit_spanned_lint(
|
||||
FORGETTING_COPY_TYPES,
|
||||
expr.span,
|
||||
ForgetCopyDiag { arg_ty, label: arg.span },
|
||||
);
|
||||
}
|
||||
sym::mem_drop if let ty::Adt(adt, _) = arg_ty.kind() && adt.is_manually_drop() => {
|
||||
sym::mem_drop
|
||||
if let ty::Adt(adt, _) = arg_ty.kind()
|
||||
&& adt.is_manually_drop() =>
|
||||
{
|
||||
cx.emit_spanned_lint(
|
||||
UNDROPPED_MANUALLY_DROPS,
|
||||
expr.span,
|
||||
|
@ -169,9 +188,9 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless {
|
|||
label: arg.span,
|
||||
suggestion: UndroppedManuallyDropsSuggestion {
|
||||
start_span: arg.span.shrink_to_lo(),
|
||||
end_span: arg.span.shrink_to_hi()
|
||||
}
|
||||
}
|
||||
end_span: arg.span.shrink_to_hi(),
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
_ => return,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue