Fix fold order for vectors (#3496)

This commit is contained in:
Laurenz 2024-02-26 14:39:41 +01:00 committed by GitHub
parent ca5d682edb
commit 85db05727b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 26 additions and 7 deletions

View File

@ -731,16 +731,16 @@ impl<T: Fold> Fold for Option<T> {
}
impl<T> Fold for Vec<T> {
fn fold(mut self, outer: Self) -> Self {
self.extend(outer);
self
fn fold(self, mut outer: Self) -> Self {
outer.extend(self);
outer
}
}
impl<T, const N: usize> Fold for SmallVec<[T; N]> {
fn fold(mut self, outer: Self) -> Self {
self.extend(outer);
self
fn fold(self, mut outer: Self) -> Self {
outer.extend(self);
outer
}
}

View File

@ -230,7 +230,6 @@ impl LayoutMultiple for Packed<EnumElem> {
let mut cells = vec![];
let mut number = self.start(styles);
let mut parents = EnumElem::parents_in(styles);
parents.reverse();
let full = self.full(styles);

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -0,0 +1,20 @@
// Test fold order of vectors.
---
#set text(features: (liga: 1))
#set text(features: (liga: 0))
fi
---
#underline(stroke: aqua + 4pt)[
#underline[Hello]
]
---
#let c = counter("mycounter")
#c.update(1)
#locate(loc => [
#c.update(2)
#c.at(loc) \
Second: #locate(loc => c.at(loc))
])