Fix clippy lints

This commit is contained in:
Jonas Platte 2022-06-29 10:15:39 +02:00
parent cd7022a0d7
commit 2e8b3e7e79
No known key found for this signature in database
GPG Key ID: AAA7A61F696C3E0C
3 changed files with 7 additions and 7 deletions

View File

@ -112,7 +112,7 @@ pub fn try_from_json_map(
/// Fallible conversion from any value that impl's `Serialize` to a `CanonicalJsonValue`.
pub fn to_canonical_value<T: Serialize>(
value: T,
) -> Result<value::CanonicalJsonValue, CanonicalJsonError> {
) -> Result<CanonicalJsonValue, CanonicalJsonError> {
serde_json::to_value(value).map_err(CanonicalJsonError::SerDe)?.try_into()
}

View File

@ -160,9 +160,9 @@ impl TreeSink for Fragment {
child: NodeOrText<Self::Handle>,
) {
if self.nodes[*element].parent.is_some() {
self.append_before_sibling(element, child)
self.append_before_sibling(element, child);
} else {
self.append(prev_element, child)
self.append(prev_element, child);
}
}
@ -200,15 +200,15 @@ impl TreeSink for Fragment {
prev_text.push_tendril(&text);
} else {
let index = self.new_node(NodeData::Text(text));
self.insert_before(*sibling, index)
self.insert_before(*sibling, index);
}
}
}
}
fn add_attrs_if_missing(&mut self, target: &Self::Handle, attrs: Vec<html5ever::Attribute>) {
fn add_attrs_if_missing(&mut self, target: &Self::Handle, attrs: Vec<Attribute>) {
let target = self.nodes[*target].as_element_mut().unwrap();
target.attrs.extend(attrs.into_iter())
target.attrs.extend(attrs.into_iter());
}
fn remove_from_parent(&mut self, target: &Self::Handle) {

View File

@ -80,7 +80,7 @@ impl HtmlSanitizer {
next_child = fragment.nodes[child].next_sibling;
if action == NodeAction::Ignore {
fragment.insert_before(node_id, child)
fragment.insert_before(node_id, child);
}
self.clean_node(fragment, child, depth + 1);