Replaced into_iter to iter (#2398)

This commit is contained in:
Sébastien d'Herbais de Thun 2023-10-17 11:15:01 +02:00 committed by GitHub
parent e4d9db83ea
commit d25c5ac9a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -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();

View File

@ -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;