Skip to content

Commit 59ac1cd

Browse files
committed
style: Use numeric constant
This solves clippy warnings like this: ``` error: usage of a legacy numeric method --> src/common.rs:418:31 | 418 | Number::from(i32::min_value()).as_i64(), | ^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants = note: `-D clippy::legacy-numeric-constants` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::legacy_numeric_constants)]` help: use the associated constant instead | 418 | Number::from(i32::MIN).as_i64(), | ~~~ ```
1 parent 4eb2275 commit 59ac1cd

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/common.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -414,14 +414,8 @@ mod tests {
414414
fn number_from_i32_and_to_i64_conversion() {
415415
assert_eq!(Number::from(1).as_i64(), Some(1));
416416
assert_eq!(Number::from(584).as_i64(), Some(584));
417-
assert_eq!(
418-
Number::from(i32::min_value()).as_i64(),
419-
Some(i32::min_value() as i64)
420-
);
421-
assert_eq!(
422-
Number::from(i32::max_value()).as_i64(),
423-
Some(i32::max_value() as i64)
424-
);
417+
assert_eq!(Number::from(i32::MIN).as_i64(), Some(i32::MIN as i64));
418+
assert_eq!(Number::from(i32::MAX).as_i64(), Some(i32::MAX as i64));
425419
}
426420

427421
#[test]

0 commit comments

Comments
 (0)