Skip to content

Commit

Permalink
Use MAX associated constant
Browse files Browse the repository at this point in the history
```
warning: use of constant `std::isize::MAX` that will be deprecated in a future Rust version: replaced by the `MAX` associated constant on this type
   --> src/utils.rs:100:68
    |
100 |         if !new_align.is_power_of_two() || new_size > core::isize::MAX as usize - (new_align - 1) {
    |                                                                    ^^^
    |
    = note: requested on the command line with `-W deprecated-in-future`

warning: use of associated function `core::num::<impl isize>::max_value` that will be deprecated in a future Rust version: replaced by the `MAX` associated constant on this type
   --> src/raw.rs:313:47
    |
313 | ...                   if state > isize::max_value() as usize {
    |                                         ^^^^^^^^^

warning: use of associated function `core::num::<impl isize>::max_value` that will be deprecated in a future Rust version: replaced by the `MAX` associated constant on this type
   --> src/raw.rs:343:27
    |
343 |         if state > isize::max_value() as usize {
    |
```
  • Loading branch information
taiki-e committed Sep 24, 2022
1 parent cfaee09 commit a3b235d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ where
// If the task is not running, now is the time to schedule.
if state & RUNNING == 0 {
// If the reference count overflowed, abort.
if state > isize::max_value() as usize {
if state > isize::MAX as usize {
abort();
}

Expand Down Expand Up @@ -340,7 +340,7 @@ where
let state = (*raw.header).state.fetch_add(REFERENCE, Ordering::Relaxed);

// If the reference count overflowed, abort.
if state > isize::max_value() as usize {
if state > isize::MAX as usize {
abort();
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl Layout {
// - align is 0 (implied false by is_power_of_two())
// - align is not a power of 2
// - size rounded up to align overflows
if !new_align.is_power_of_two() || new_size > core::isize::MAX as usize - (new_align - 1) {
if !new_align.is_power_of_two() || new_size > isize::MAX as usize - (new_align - 1) {
return None;
}

Expand Down

0 comments on commit a3b235d

Please sign in to comment.