summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien d'Herbais de Thun <sebastien.d.herbais@gmail.com>2023-10-17 11:15:01 +0200
committerGitHub <noreply@github.com>2023-10-17 11:15:01 +0200
commitd25c5ac9a20d4f9645bc649773238b632b4359a0 (patch)
tree83f57d91942812132a5f2fcde12a1a96a31c70bc
parente4d9db83ea4b7b9a3003c754c80b30b87d6cd119 (diff)
Replaced `into_iter` to `iter` (#2398)
-rw-r--r--crates/typst-library/src/meta/bibliography.rs7
-rw-r--r--crates/typst/src/export/pdf/outline.rs4
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 2fe86060..5d3495be 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<Introspector>) -> StrResult<Self> {
- 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::<Self>().unwrap();
load(&elem.path(), &elem.data())
@@ -137,7 +138,7 @@ impl BibliographyElem {
) -> Vec<(EcoString, Option<EcoString>)> {
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 7aa15c41..d29852fd 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<Ref> {
// 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;