diff options
| author | TennyZhuang <zty0826@gmail.com> | 2022-10-02 19:04:33 +0800 |
|---|---|---|
| committer | TennyZhuang <zty0826@gmail.com> | 2022-10-02 23:02:13 +0800 |
| commit | c9b93143d52ed3393602db29c1e31db03e0fdab2 (patch) | |
| tree | 2c085c1debce43aac481d3a6a5c4aa4fdd6b5637 | |
| parent | bff811bfdf117ac737d44452c8aa645dd516f8a0 (diff) | |
| download | rust-c9b93143d52ed3393602db29c1e31db03e0fdab2.tar.gz rust-c9b93143d52ed3393602db29c1e31db03e0fdab2.zip | |
fix some logics
Signed-off-by: TennyZhuang <zty0826@gmail.com>
| -rw-r--r-- | clippy_lints/src/casts/unnecessary_cast.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clippy_lints/src/casts/unnecessary_cast.rs b/clippy_lints/src/casts/unnecessary_cast.rs index 610e8f712f4..21ed7f4844c 100644 --- a/clippy_lints/src/casts/unnecessary_cast.rs +++ b/clippy_lints/src/casts/unnecessary_cast.rs @@ -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() => |
