mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 16:39:26 +00:00
fix some logics
Signed-off-by: TennyZhuang <zty0826@gmail.com>
This commit is contained in:
parent
bff811bfdf
commit
c9b93143d5
1 changed files with 5 additions and 3 deletions
|
@ -53,13 +53,15 @@ pub(super) fn check<'tcx>(
|
||||||
match lit.node {
|
match lit.node {
|
||||||
LitKind::Int(_, LitIntType::Unsuffixed) if cast_to.is_integral() => {
|
LitKind::Int(_, LitIntType::Unsuffixed) if cast_to.is_integral() => {
|
||||||
lint_unnecessary_cast(cx, expr, literal_str, cast_from, cast_to);
|
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() => {
|
LitKind::Float(_, LitFloatType::Unsuffixed) if cast_to.is_floating_point() => {
|
||||||
lint_unnecessary_cast(cx, expr, literal_str, cast_from, cast_to);
|
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::Int(_, LitIntType::Signed(_) | LitIntType::Unsigned(_))
|
||||||
| LitKind::Float(_, LitFloatType::Suffixed(_))
|
| LitKind::Float(_, LitFloatType::Suffixed(_))
|
||||||
if cast_from.kind() == cast_to.kind() =>
|
if cast_from.kind() == cast_to.kind() =>
|
||||||
|
|
Loading…
Reference in a new issue