head: saturate to max int size on 32 bit platforms

This commit is contained in:
Jeremy Smart
2025-04-12 23:38:32 +02:00
committed by Sylvestre Ledru
parent cc1112660a
commit 37eee0e1e6
+1 -7
View File
@@ -282,13 +282,7 @@ fn read_n_lines(input: &mut impl io::BufRead, n: u64, separator: u8) -> io::Resu
}
fn catch_too_large_numbers_in_backwards_bytes_or_lines(n: u64) -> Option<usize> {
match usize::try_from(n) {
Ok(value) => Some(value),
Err(e) => {
show!(HeadError::NumTooLarge(e));
None
}
}
usize::try_from(n).ok()
}
fn read_but_last_n_bytes(mut input: impl Read, n: u64) -> io::Result<u64> {