Skip to content

Commit dfc49c9

Browse files
committed
clamp is not available yet on 1.48
1 parent f16efaf commit dfc49c9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/multi/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@ where
373373
return Err(Err::Failure(E::from_error_kind(input, ErrorKind::ManyMN)));
374374
}
375375

376-
let mut res = crate::lib::std::vec::Vec::with_capacity(min.clamp(0, MAX_INITIAL_CAPACITY));
376+
let mut res =
377+
crate::lib::std::vec::Vec::with_capacity(std::cmp::min(min, MAX_INITIAL_CAPACITY));
377378
for count in 0..max {
378379
let len = input.input_len();
379380
match parse.parse(input.clone()) {
@@ -540,7 +541,8 @@ where
540541
{
541542
move |i: I| {
542543
let mut input = i.clone();
543-
let mut res = crate::lib::std::vec::Vec::with_capacity(count.clamp(0, MAX_INITIAL_CAPACITY));
544+
let mut res =
545+
crate::lib::std::vec::Vec::with_capacity(std::cmp::min(count, MAX_INITIAL_CAPACITY));
544546

545547
for _ in 0..count {
546548
let input_ = input.clone();

0 commit comments

Comments
 (0)