]> git.lizzy.rs Git - rust.git/commitdiff
fix some logics
authorTennyZhuang <zty0826@gmail.com>
Sun, 2 Oct 2022 11:04:33 +0000 (19:04 +0800)
committerTennyZhuang <zty0826@gmail.com>
Sun, 2 Oct 2022 15:02:13 +0000 (23:02 +0800)
Signed-off-by: TennyZhuang <zty0826@gmail.com>
clippy_lints/src/casts/unnecessary_cast.rs

index 610e8f712f497252fd3c4f358e389ea8302efb98..21ed7f4844cc593948bbb21bc6a69c1c37ca126c 100644 (file)
@@ -53,13 +53,15 @@ pub(super) fn check<'tcx>(
         match lit.node {
             LitKind::Int(_, LitIntType::Unsuffixed) if cast_to.is_integral() => {
                 lint_unnecessary_cast(cx, expr, literal_str, cast_from, cast_to);
-                return true;
+                return false;
             },
             LitKind::Float(_, LitFloatType::Unsuffixed) if cast_to.is_floating_point() => {
                 lint_unnecessary_cast(cx, expr, literal_str, cast_from, cast_to);
-                return true;
+                return false;
+            },
+            LitKind::Int(_, LitIntType::Unsuffixed) | LitKind::Float(_, LitFloatType::Unsuffixed) => {
+                return false;
             },
-            LitKind::Int(_, LitIntType::Unsuffixed) | LitKind::Float(_, LitFloatType::Unsuffixed) => {},
             LitKind::Int(_, LitIntType::Signed(_) | LitIntType::Unsigned(_))
             | LitKind::Float(_, LitFloatType::Suffixed(_))
                 if cast_from.kind() == cast_to.kind() =>