mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 21:53:23 +00:00
Remove 'lint_numeric_casts'
This commit is contained in:
parent
9709993e41
commit
0dce9921fd
1 changed files with 7 additions and 17 deletions
|
@ -302,8 +302,14 @@ impl<'tcx> LateLintPass<'tcx> for Casts {
|
|||
return;
|
||||
}
|
||||
lint_fn_to_numeric_cast(cx, expr, cast_expr, cast_from, cast_to);
|
||||
lint_numeric_casts(cx, expr, cast_expr, cast_from, cast_to);
|
||||
lint_cast_ptr_alignment(cx, expr, cast_from, cast_to);
|
||||
if cast_from.is_numeric() && cast_to.is_numeric() && !in_external_macro(cx.sess(), expr.span) {
|
||||
cast_possible_truncation::check(cx, expr, cast_from, cast_to);
|
||||
cast_possible_wrap::check(cx, expr, cast_from, cast_to);
|
||||
cast_precision_loss::check(cx, expr, cast_from, cast_to);
|
||||
cast_lossless::check(cx, expr, cast_expr, cast_from, cast_to);
|
||||
cast_sign_loss::check(cx, expr, cast_expr, cast_from, cast_to);
|
||||
}
|
||||
} else if let ExprKind::MethodCall(method_path, _, args, _) = expr.kind {
|
||||
if_chain! {
|
||||
if method_path.ident.name == sym!(cast);
|
||||
|
@ -321,22 +327,6 @@ impl<'tcx> LateLintPass<'tcx> for Casts {
|
|||
}
|
||||
}
|
||||
|
||||
fn lint_numeric_casts<'tcx>(
|
||||
cx: &LateContext<'tcx>,
|
||||
expr: &Expr<'tcx>,
|
||||
cast_op: &Expr<'_>,
|
||||
cast_from: Ty<'tcx>,
|
||||
cast_to: Ty<'tcx>,
|
||||
) {
|
||||
if cast_from.is_numeric() && cast_to.is_numeric() && !in_external_macro(cx.sess(), expr.span) {
|
||||
cast_possible_truncation::check(cx, expr, cast_from, cast_to);
|
||||
cast_possible_wrap::check(cx, expr, cast_from, cast_to);
|
||||
cast_precision_loss::check(cx, expr, cast_from, cast_to);
|
||||
cast_lossless::check(cx, expr, cast_op, cast_from, cast_to);
|
||||
cast_sign_loss::check(cx, expr, cast_op, cast_from, cast_to);
|
||||
}
|
||||
}
|
||||
|
||||
fn lint_cast_ptr_alignment<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'_>, cast_from: Ty<'tcx>, cast_to: Ty<'tcx>) {
|
||||
if_chain! {
|
||||
if let ty::RawPtr(from_ptr_ty) = &cast_from.kind();
|
||||
|
|
Loading…
Reference in a new issue