From d25c5ac9a20d4f9645bc649773238b632b4359a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20d=27Herbais=20de=20Thun?= Date: Tue, 17 Oct 2023 11:15:01 +0200 Subject: [PATCH] Replaced `into_iter` to `iter` (#2398) --- crates/typst-library/src/meta/bibliography.rs | 7 ++++--- crates/typst/src/export/pdf/outline.rs | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/typst-library/src/meta/bibliography.rs b/crates/typst-library/src/meta/bibliography.rs index 2fe860606..5d3495be5 100644 --- a/crates/typst-library/src/meta/bibliography.rs +++ b/crates/typst-library/src/meta/bibliography.rs @@ -106,7 +106,8 @@ cast! { impl BibliographyElem { /// Find the document's bibliography. pub fn find(introspector: Tracked) -> StrResult { - let mut iter = introspector.query(&Self::elem().select()).into_iter(); + let query = introspector.query(&Self::elem().select()); + let mut iter = query.iter(); let Some(elem) = iter.next() else { bail!("the document does not contain a bibliography"); }; @@ -122,7 +123,7 @@ impl BibliographyElem { pub fn has(vt: &Vt, key: &str) -> bool { vt.introspector .query(&Self::elem().select()) - .into_iter() + .iter() .flat_map(|elem| { let elem = elem.to::().unwrap(); load(&elem.path(), &elem.data()) @@ -137,7 +138,7 @@ impl BibliographyElem { ) -> Vec<(EcoString, Option)> { Self::find(introspector) .and_then(|elem| load(&elem.path(), &elem.data())) - .into_iter() + .iter() .flatten() .map(|entry| { let key = entry.key().into(); diff --git a/crates/typst/src/export/pdf/outline.rs b/crates/typst/src/export/pdf/outline.rs index 7aa15c417..d29852fd9 100644 --- a/crates/typst/src/export/pdf/outline.rs +++ b/crates/typst/src/export/pdf/outline.rs @@ -17,8 +17,8 @@ pub fn write_outline(ctx: &mut PdfContext) -> Option { // Therefore, its next descendant must be added at its level, which is // enforced in the manner shown below. let mut last_skipped_level = None; - for heading in ctx.introspector.query(&item!(heading_elem).select()) { - let leaf = HeadingNode::leaf((*heading).clone()); + for heading in ctx.introspector.query(&item!(heading_elem).select()).iter() { + let leaf = HeadingNode::leaf((**heading).clone()); if leaf.bookmarked { let mut children = &mut tree;