mirror of
https://github.com/typst/typst
synced 2025-06-13 23:56:25 +08:00
Clippy
This commit is contained in:
parent
d4242ff8c1
commit
e1dbdbd150
@ -238,15 +238,10 @@ impl Introspector {
|
|||||||
|
|
||||||
/// Query for a unique element with the label.
|
/// Query for a unique element with the label.
|
||||||
pub fn query_label(&self, label: Label) -> Result<&Content, QueryError> {
|
pub fn query_label(&self, label: Label) -> Result<&Content, QueryError> {
|
||||||
let indices = self
|
let indices = self.labels.get(&label).ok_or(QueryError::MissingLabel(label))?;
|
||||||
.labels
|
|
||||||
.get(&label)
|
|
||||||
.ok_or_else(|| QueryError::MissingLabel(label))?;
|
|
||||||
|
|
||||||
if indices.len() > 1 {
|
if indices.len() > 1 {
|
||||||
return Err(QueryError::MultipleLabels(label));
|
return Err(QueryError::MultipleLabels(label));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(&self.elems[indices[0]].0)
|
Ok(&self.elems[indices[0]].0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,8 +328,8 @@ pub(crate) fn unresolved_reference(
|
|||||||
eco_format!("#{func}(label({}))", target.as_str().repr())
|
eco_format!("#{func}(label({}))", target.as_str().repr())
|
||||||
};
|
};
|
||||||
|
|
||||||
return RawElem::new(RawContent::Text(text))
|
RawElem::new(RawContent::Text(text))
|
||||||
.pack()
|
.pack()
|
||||||
.spanned(span)
|
.spanned(span)
|
||||||
.styled(TextElem::set_fill(Color::RED.into()));
|
.styled(TextElem::set_fill(Color::RED.into()))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user