Skip to content

Commit aaf14f3

Browse files
committed
Replace conditionals with range-containment
1 parent 5faf18d commit aaf14f3

File tree

1 file changed

+2
-2
lines changed
  • rust-runtime/aws-smithy-types/src

1 file changed

+2
-2
lines changed

rust-runtime/aws-smithy-types/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ impl TryFrom<Number> for f64 {
291291
}
292292
}
293293
Number::NegInt(v) => {
294-
if -(1 << 53) <= v && v <= (1 << 53) {
294+
if (-(1 << 53)..=(1 << 53)).contains(&v) {
295295
Ok(v as Self)
296296
} else {
297297
Err(Self::Error::I64ToFloatLossyConversion(v))
@@ -316,7 +316,7 @@ impl TryFrom<Number> for f32 {
316316
}
317317
}
318318
Number::NegInt(v) => {
319-
if -(1 << 24) <= v && v <= (1 << 24) {
319+
if (-(1 << 24)..=(1 << 24)).contains(&v) {
320320
Ok(v as Self)
321321
} else {
322322
Err(Self::Error::I64ToFloatLossyConversion(v))

0 commit comments

Comments
 (0)