Fix clippy lints
This commit is contained in:
parent
cd7022a0d7
commit
2e8b3e7e79
@ -112,7 +112,7 @@ pub fn try_from_json_map(
|
|||||||
/// Fallible conversion from any value that impl's `Serialize` to a `CanonicalJsonValue`.
|
/// Fallible conversion from any value that impl's `Serialize` to a `CanonicalJsonValue`.
|
||||||
pub fn to_canonical_value<T: Serialize>(
|
pub fn to_canonical_value<T: Serialize>(
|
||||||
value: T,
|
value: T,
|
||||||
) -> Result<value::CanonicalJsonValue, CanonicalJsonError> {
|
) -> Result<CanonicalJsonValue, CanonicalJsonError> {
|
||||||
serde_json::to_value(value).map_err(CanonicalJsonError::SerDe)?.try_into()
|
serde_json::to_value(value).map_err(CanonicalJsonError::SerDe)?.try_into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,9 +160,9 @@ impl TreeSink for Fragment {
|
|||||||
child: NodeOrText<Self::Handle>,
|
child: NodeOrText<Self::Handle>,
|
||||||
) {
|
) {
|
||||||
if self.nodes[*element].parent.is_some() {
|
if self.nodes[*element].parent.is_some() {
|
||||||
self.append_before_sibling(element, child)
|
self.append_before_sibling(element, child);
|
||||||
} else {
|
} else {
|
||||||
self.append(prev_element, child)
|
self.append(prev_element, child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,15 +200,15 @@ impl TreeSink for Fragment {
|
|||||||
prev_text.push_tendril(&text);
|
prev_text.push_tendril(&text);
|
||||||
} else {
|
} else {
|
||||||
let index = self.new_node(NodeData::Text(text));
|
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();
|
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) {
|
fn remove_from_parent(&mut self, target: &Self::Handle) {
|
||||||
|
@ -80,7 +80,7 @@ impl HtmlSanitizer {
|
|||||||
next_child = fragment.nodes[child].next_sibling;
|
next_child = fragment.nodes[child].next_sibling;
|
||||||
|
|
||||||
if action == NodeAction::Ignore {
|
if action == NodeAction::Ignore {
|
||||||
fragment.insert_before(node_id, child)
|
fragment.insert_before(node_id, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.clean_node(fragment, child, depth + 1);
|
self.clean_node(fragment, child, depth + 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user