From a3b235d32ac1f68e470e37cdf3db603bf5ee0c92 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sat, 24 Sep 2022 17:18:56 +0900 Subject: [PATCH] Use MAX associated constant ``` 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::::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::::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 { | ``` --- src/raw.rs | 4 ++-- src/utils.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/raw.rs b/src/raw.rs index bb031da..ec2a6ec 100644 --- a/src/raw.rs +++ b/src/raw.rs @@ -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(); } @@ -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(); } diff --git a/src/utils.rs b/src/utils.rs index ebaf752..5c2170c 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -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; }