Skip to content

Commit

Permalink
style: Use numeric constant
Browse files Browse the repository at this point in the history
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(),
    |                               ~~~

```
  • Loading branch information
caspermeijn committed Dec 19, 2024
1 parent 4eb2275 commit eacee3c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,12 +415,12 @@ mod tests {
assert_eq!(Number::from(1).as_i64(), Some(1));
assert_eq!(Number::from(584).as_i64(), Some(584));
assert_eq!(
Number::from(i32::min_value()).as_i64(),
Some(i32::min_value() as i64)
Number::from(i32::MIN).as_i64(),
Some(i32::MIN as i64)
);
assert_eq!(
Number::from(i32::max_value()).as_i64(),
Some(i32::max_value() as i64)
Number::from(i32::MAX).as_i64(),
Some(i32::MAX as i64)
);
}

Expand Down

0 comments on commit eacee3c

Please sign in to comment.