diff options
| author | Lzu Tao <taolzu@gmail.com> | 2020-06-01 17:03:47 +0000 |
|---|---|---|
| committer | Lzu Tao <taolzu@gmail.com> | 2020-06-01 17:03:47 +0000 |
| commit | b2c44696ad792bc2a2b2ee76e74e7dfdbef80e98 (patch) | |
| tree | 5126fb02e8bc33254251df681562b376828cbefb /src/libcore/num | |
| parent | b85e3fe010413b8c528d4de593d912a5ba024653 (diff) | |
| download | rust-b2c44696ad792bc2a2b2ee76e74e7dfdbef80e98.tar.gz rust-b2c44696ad792bc2a2b2ee76e74e7dfdbef80e98.zip | |
Add associated consts MIN/MAX for Wrapping<Int>
Diffstat (limited to 'src/libcore/num')
| -rw-r--r-- | src/libcore/num/wrapping.rs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs index 82fa6acfbd6..bb648ba8c25 100644 --- a/src/libcore/num/wrapping.rs +++ b/src/libcore/num/wrapping.rs @@ -337,14 +337,10 @@ Basic usage: #![feature(wrapping_int_impl)] use std::num::Wrapping; -assert_eq!(<Wrapping<", stringify!($t), ">>::min_value(), ", -"Wrapping(", stringify!($t), "::min_value())); +assert_eq!(<Wrapping<", stringify!($t), ">>::MIN, Wrapping(", stringify!($t), "::MIN)); ```"), #[unstable(feature = "wrapping_int_impl", issue = "32463")] - #[inline] - pub const fn min_value() -> Self { - Wrapping(<$t>::min_value()) - } + pub const MIN: Self = Self(<$t>::MIN); } doc_comment! { @@ -358,14 +354,10 @@ Basic usage: #![feature(wrapping_int_impl)] use std::num::Wrapping; -assert_eq!(<Wrapping<", stringify!($t), ">>::max_value(), ", -"Wrapping(", stringify!($t), "::max_value())); +assert_eq!(<Wrapping<", stringify!($t), ">>::MAX, Wrapping(", stringify!($t), "::MAX)); ```"), #[unstable(feature = "wrapping_int_impl", issue = "32463")] - #[inline] - pub const fn max_value() -> Self { - Wrapping(<$t>::max_value()) - } + pub const MAX: Self = Self(<$t>::MAX); } doc_comment! { |
