mirror of
https://github.com/typst/typst
synced 2025-06-28 08:12:53 +08:00
Replaced into_iter
to iter
(#2398)
This commit is contained in:
parent
e4d9db83ea
commit
d25c5ac9a2
@ -106,7 +106,8 @@ cast! {
|
|||||||
impl BibliographyElem {
|
impl BibliographyElem {
|
||||||
/// Find the document's bibliography.
|
/// Find the document's bibliography.
|
||||||
pub fn find(introspector: Tracked<Introspector>) -> StrResult<Self> {
|
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 {
|
let Some(elem) = iter.next() else {
|
||||||
bail!("the document does not contain a bibliography");
|
bail!("the document does not contain a bibliography");
|
||||||
};
|
};
|
||||||
@ -122,7 +123,7 @@ impl BibliographyElem {
|
|||||||
pub fn has(vt: &Vt, key: &str) -> bool {
|
pub fn has(vt: &Vt, key: &str) -> bool {
|
||||||
vt.introspector
|
vt.introspector
|
||||||
.query(&Self::elem().select())
|
.query(&Self::elem().select())
|
||||||
.into_iter()
|
.iter()
|
||||||
.flat_map(|elem| {
|
.flat_map(|elem| {
|
||||||
let elem = elem.to::<Self>().unwrap();
|
let elem = elem.to::<Self>().unwrap();
|
||||||
load(&elem.path(), &elem.data())
|
load(&elem.path(), &elem.data())
|
||||||
@ -137,7 +138,7 @@ impl BibliographyElem {
|
|||||||
) -> Vec<(EcoString, Option<EcoString>)> {
|
) -> Vec<(EcoString, Option<EcoString>)> {
|
||||||
Self::find(introspector)
|
Self::find(introspector)
|
||||||
.and_then(|elem| load(&elem.path(), &elem.data()))
|
.and_then(|elem| load(&elem.path(), &elem.data()))
|
||||||
.into_iter()
|
.iter()
|
||||||
.flatten()
|
.flatten()
|
||||||
.map(|entry| {
|
.map(|entry| {
|
||||||
let key = entry.key().into();
|
let key = entry.key().into();
|
||||||
|
@ -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
|
// Therefore, its next descendant must be added at its level, which is
|
||||||
// enforced in the manner shown below.
|
// enforced in the manner shown below.
|
||||||
let mut last_skipped_level = None;
|
let mut last_skipped_level = None;
|
||||||
for heading in ctx.introspector.query(&item!(heading_elem).select()) {
|
for heading in ctx.introspector.query(&item!(heading_elem).select()).iter() {
|
||||||
let leaf = HeadingNode::leaf((*heading).clone());
|
let leaf = HeadingNode::leaf((**heading).clone());
|
||||||
|
|
||||||
if leaf.bookmarked {
|
if leaf.bookmarked {
|
||||||
let mut children = &mut tree;
|
let mut children = &mut tree;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user