Skip to content

Commit bdf0c1d

Browse files
author
Kamil Niski
committed
Remove std dep from integer MAX, MIN
1 parent ae63b9e commit bdf0c1d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/ops/overflowing.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
use core::ops::{Add, Mul, Sub};
2+
#[cfg(has_i128)]
3+
use core::{i128, u128};
4+
use core::{i16, i32, i64, i8, isize};
5+
use core::{u16, u32, u64, u8, usize};
26

37
macro_rules! overflowing_impl {
48
($trait_name:ident, $method:ident, $t:ty) => {
@@ -89,9 +93,9 @@ fn test_overflowing_traits() {
8993
a.overflowing_mul(&b)
9094
}
9195
assert_eq!(overflowing_add(5i16, 2), (7, false));
92-
assert_eq!(overflowing_add(std::i16::MAX, 1), (std::i16::MIN, true));
96+
assert_eq!(overflowing_add(i16::MAX, 1), (i16::MIN, true));
9397
assert_eq!(overflowing_sub(5i16, 2), (3, false));
94-
assert_eq!(overflowing_sub(std::i16::MIN, 1), (std::i16::MAX, true));
98+
assert_eq!(overflowing_sub(i16::MIN, 1), (i16::MAX, true));
9599
assert_eq!(overflowing_mul(5i16, 2), (10, false));
96100
assert_eq!(overflowing_mul(1_000_000_000i32, 10), (1410065408, true));
97101
}

0 commit comments

Comments
 (0)