Skip to content

Commit 189aa8b

Browse files
committed
Fix clippy lints surfaced by a newer toolchain
CI runs with an unpinned `@stable` Rust toolchain, and a newer clippy than the last green `main` run flags pre-existing code: - collapsible_match in interpreter/interpret.rs and xslt-ast/ whitespace.rs (an `if` inside a match arm folded into a guard) - useless_conversion in library/map.rs (redundant `.into_iter()` in two `Vec::extend` calls) None of these are introduced by this branch -- they are unchanged from `main` -- but they fail `cargo clippy -D warnings`, so fix them here to unblock CI. The durable fix is upstream pinning the toolchain.
1 parent c59a8e8 commit 189aa8b

3 files changed

Lines changed: 8 additions & 11 deletions

File tree

xee-interpreter/src/interpreter/interpret.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,13 +1130,11 @@ impl<'a> Interpreter<'a> {
11301130
"Appending a whole document is not supported yet",
11311131
)));
11321132
}
1133-
xot::Value::Text(text) => {
1133+
xot::Value::Text(text) if text.get().is_empty() => {
11341134
// zero length text nodes are skipped
11351135
// Can this even exist, or does Xot not have
11361136
// them anyway?
1137-
if text.get().is_empty() {
1138-
continue;
1139-
}
1137+
continue;
11401138
}
11411139
_ => {}
11421140
}

xee-interpreter/src/library/map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ fn find_helper(
162162
function::Function::Array(array) => {
163163
for entry in array.iter() {
164164
let found = find_helper(entry, key.clone())?;
165-
result.extend(found.into_iter())
165+
result.extend(found)
166166
}
167167
}
168168
function::Function::Map(map) => {
@@ -171,7 +171,7 @@ fn find_helper(
171171
result.push(v.clone());
172172
}
173173
let found = find_helper(v, key.clone())?;
174-
result.extend(found.into_iter())
174+
result.extend(found)
175175
}
176176
}
177177
_ => {}

xee-xslt-ast/src/whitespace.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@ pub(crate) fn strip_whitespace(xot: &mut Xot, names: &Names, node: Node) {
1414
for edge in xot.traverse(node) {
1515
match edge {
1616
NodeEdge::Start(node) => match xot.value(node) {
17-
Value::Text(text) => {
17+
Value::Text(text)
1818
if is_xml_whitespace(text.get())
19-
&& !is_xml_space_preserve(xot, names, node, &xml_space_preserve)
20-
{
21-
to_remove.push(node);
22-
}
19+
&& !is_xml_space_preserve(xot, names, node, &xml_space_preserve) =>
20+
{
21+
to_remove.push(node);
2322
}
2423
Value::Element(_) => {
2524
if let Some(xml_space) = xot.attributes(node).get(xot.xml_space_name()) {

0 commit comments

Comments
 (0)