Skip to content

Commit 3ee7bb1

Browse files
committed
better def of is signed in tests.
1 parent 79e8653 commit 3ee7bb1

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

library/core/tests/num/mod.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,9 @@ fn test_int_from_str_overflow() {
124124
fn test_can_not_overflow() {
125125
fn can_overflow<T>(radix: u32, input: &str) -> bool
126126
where
127-
T: Default
128-
+ core::ops::Sub<Output = T>
129-
+ std::convert::From<bool>
130-
+ std::cmp::PartialOrd
131-
+ Copy,
127+
T: std::convert::TryFrom<i8>,
132128
{
133-
let one = true.into();
134-
let zero = <T>::default();
135-
!can_not_overflow::<T>(radix, zero - one < zero, input.as_bytes())
129+
!can_not_overflow::<T>(radix, T::try_from(-1_i8).is_ok(), input.as_bytes())
136130
}
137131

138132
// Positive tests:

0 commit comments

Comments
 (0)