Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,8 @@ pub fn get_preference(name: impl AsRef<str>) -> Result<String> {
}
if value == NO_PREFERENCE {
bail!("No preference named '{}'", name);
} else {
return Ok(value);
}
Ok(value)
Comment thread
moritz-gross marked this conversation as resolved.
Outdated
})
}));
return report_any_panic(result);
Expand Down
11 changes: 3 additions & 8 deletions src/xpath_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ fn get_text_from_element(e: Element) -> String {
#[allow(non_snake_case)]
// Same as 'is_tag', but for ChildOfElement
fn get_text_from_COE(coe: &ChildOfElement) -> String {
let element = coe.element();
return match element {
Some(e) => get_text_from_element(e),
None => "".to_string(),
};
coe.element().map_or_else(String::new, get_text_from_element)
}

// make sure that there is only one node in the NodeSet
Expand All @@ -73,8 +69,7 @@ fn is_tag(e: Element, name: &str) -> bool {
#[allow(non_snake_case)]
// Same as 'is_tag', but for ChildOfElement
fn is_COE_tag(coe: ChildOfElement, name: &str) -> bool {
let element = coe.element();
return element.is_some() && is_tag(element.unwrap(), name)
coe.element().is_some_and(|element| is_tag(element, name))
}

/// Should be an internal structure for implementation of the IsNode, but it was useful in one place in a separate module.
Expand Down Expand Up @@ -1636,4 +1631,4 @@ mod tests {
let mn = as_element(as_element(fraction.children()[1]).children()[0]);
assert_eq!(EdgeNode::edge_node(mn, true, "2D"), None);
}
}
}
Loading