Introduce DotDotPos
.
This shrinks `hir::Pat` from 88 to 72 bytes.
This commit is contained in:
parent
4314615ff8
commit
e67f39f8bc
15 changed files with 85 additions and 47 deletions
|
@ -35,7 +35,7 @@ pub trait EnumerateAndAdjustIterator {
|
|||
fn enumerate_and_adjust(
|
||||
self,
|
||||
expected_len: usize,
|
||||
gap_pos: Option<usize>,
|
||||
gap_pos: hir::DotDotPos,
|
||||
) -> EnumerateAndAdjust<Self>
|
||||
where
|
||||
Self: Sized;
|
||||
|
@ -45,7 +45,7 @@ impl<T: ExactSizeIterator> EnumerateAndAdjustIterator for T {
|
|||
fn enumerate_and_adjust(
|
||||
self,
|
||||
expected_len: usize,
|
||||
gap_pos: Option<usize>,
|
||||
gap_pos: hir::DotDotPos,
|
||||
) -> EnumerateAndAdjust<Self>
|
||||
where
|
||||
Self: Sized,
|
||||
|
@ -53,7 +53,7 @@ impl<T: ExactSizeIterator> EnumerateAndAdjustIterator for T {
|
|||
let actual_len = self.len();
|
||||
EnumerateAndAdjust {
|
||||
enumerate: self.enumerate(),
|
||||
gap_pos: gap_pos.unwrap_or(expected_len),
|
||||
gap_pos: gap_pos.as_opt_usize().unwrap_or(expected_len),
|
||||
gap_len: expected_len - actual_len,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue