Skip to content

Commit 4d6cad4

Browse files
author
Paul Kernfeld
committed
Avoid long literals
1 parent 4d9feea commit 4d6cad4

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/iter/find_first_last/test.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ fn find_last_folder_yields_last_match() {
104104
/// Produce a parallel iterator for 0u128..10²⁷
105105
#[cfg(has_i128)]
106106
fn octillion() -> impl ParallelIterator<Item = u128> {
107-
(0u128..1_000_000_000_000_000_000_000_000_000).into_par_iter()
107+
// Using parse because some versions of rust don't allow long literals
108+
let octillion = "1000000000000000000000000000".parse::<u128>().unwrap();
109+
(0u128..octillion).into_par_iter()
108110
}
109111

110112
/// Produce a parallel iterator for 0u128..10²⁷

src/range.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ pub fn check_range_split_at_overflow() {
203203
#[cfg(has_i128)]
204204
#[test]
205205
pub fn test_i128_len_doesnt_overflow() {
206-
let octillion = 1_000_000_000_000_000_000_000_000_000i128;
206+
// Using parse because some versions of rust don't allow long literals
207+
let octillion = "1000000000000000000000000000".parse::<i128>().unwrap();
207208
let producer = IterProducer { range: 0..octillion };
208209

209210
assert_eq!(octillion as u128, producer.len());

0 commit comments

Comments
 (0)