diff options
| author | Giles Cope <gilescope@gmail.com> | 2022-04-11 07:37:53 +0100 |
|---|---|---|
| committer | Giles Cope <gilescope@gmail.com> | 2022-04-11 07:37:53 +0100 |
| commit | 3ee7bb19c62761f5387c463a804d970c1ea3db72 (patch) | |
| tree | 882296c87a3f5f379c79c9c26263aee0aeb5e8ac | |
| parent | 79e86536563a0bd627ee27937925ab4d2df2b141 (diff) | |
| download | rust-3ee7bb19c62761f5387c463a804d970c1ea3db72.tar.gz rust-3ee7bb19c62761f5387c463a804d970c1ea3db72.zip | |
better def of is signed in tests.
| -rw-r--r-- | library/core/tests/num/mod.rs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/library/core/tests/num/mod.rs b/library/core/tests/num/mod.rs index 10b8d975442..49580cdcc48 100644 --- a/library/core/tests/num/mod.rs +++ b/library/core/tests/num/mod.rs @@ -124,15 +124,9 @@ fn test_int_from_str_overflow() { fn test_can_not_overflow() { fn can_overflow<T>(radix: u32, input: &str) -> bool where - T: Default - + core::ops::Sub<Output = T> - + std::convert::From<bool> - + std::cmp::PartialOrd - + Copy, + T: std::convert::TryFrom<i8>, { - let one = true.into(); - let zero = <T>::default(); - !can_not_overflow::<T>(radix, zero - one < zero, input.as_bytes()) + !can_not_overflow::<T>(radix, T::try_from(-1_i8).is_ok(), input.as_bytes()) } // Positive tests: |
