Skip to content

Commit c9b9314

Browse files
committed
fix some logics
Signed-off-by: TennyZhuang <[email protected]>
1 parent bff811b commit c9b9314

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

clippy_lints/src/casts/unnecessary_cast.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@ pub(super) fn check<'tcx>(
5353
match lit.node {
5454
LitKind::Int(_, LitIntType::Unsuffixed) if cast_to.is_integral() => {
5555
lint_unnecessary_cast(cx, expr, literal_str, cast_from, cast_to);
56-
return true;
56+
return false;
5757
},
5858
LitKind::Float(_, LitFloatType::Unsuffixed) if cast_to.is_floating_point() => {
5959
lint_unnecessary_cast(cx, expr, literal_str, cast_from, cast_to);
60-
return true;
60+
return false;
61+
},
62+
LitKind::Int(_, LitIntType::Unsuffixed) | LitKind::Float(_, LitFloatType::Unsuffixed) => {
63+
return false;
6164
},
62-
LitKind::Int(_, LitIntType::Unsuffixed) | LitKind::Float(_, LitFloatType::Unsuffixed) => {},
6365
LitKind::Int(_, LitIntType::Signed(_) | LitIntType::Unsigned(_))
6466
| LitKind::Float(_, LitFloatType::Suffixed(_))
6567
if cast_from.kind() == cast_to.kind() =>

0 commit comments

Comments
 (0)