summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-09-17 11:26:39 +0200
committerLaurenz <laurmaedje@gmail.com>2024-09-17 11:26:45 +0200
commite1dbdbd150fd30b6df4e6ae5a12df98bc2a2b063 (patch)
tree2e35230d2087532eb2e54bac0427202c0e5ff4d0
parentd4242ff8c1086842a6d7c601d4ffe32feb6f9bc2 (diff)
-rw-r--r--crates/typst/src/introspection/introspector.rs7
-rw-r--r--crates/typst/src/model/reference.rs4
2 files changed, 3 insertions, 8 deletions
diff --git a/crates/typst/src/introspection/introspector.rs b/crates/typst/src/introspection/introspector.rs
index 3528357b..2153d912 100644
--- a/crates/typst/src/introspection/introspector.rs
+++ b/crates/typst/src/introspection/introspector.rs
@@ -238,15 +238,10 @@ impl Introspector {
/// Query for a unique element with the label.
pub fn query_label(&self, label: Label) -> Result<&Content, QueryError> {
- let indices = self
- .labels
- .get(&label)
- .ok_or_else(|| QueryError::MissingLabel(label))?;
-
+ let indices = self.labels.get(&label).ok_or(QueryError::MissingLabel(label))?;
if indices.len() > 1 {
return Err(QueryError::MultipleLabels(label));
}
-
Ok(&self.elems[indices[0]].0)
}
diff --git a/crates/typst/src/model/reference.rs b/crates/typst/src/model/reference.rs
index 33ae1480..8715d448 100644
--- a/crates/typst/src/model/reference.rs
+++ b/crates/typst/src/model/reference.rs
@@ -328,8 +328,8 @@ pub(crate) fn unresolved_reference(
eco_format!("#{func}(label({}))", target.as_str().repr())
};
- return RawElem::new(RawContent::Text(text))
+ RawElem::new(RawContent::Text(text))
.pack()
.spanned(span)
- .styled(TextElem::set_fill(Color::RED.into()));
+ .styled(TextElem::set_fill(Color::RED.into()))
}