Small readability improvements to satisfy lints.

This commit is contained in:
Stu Black 2025-01-08 14:40:10 -05:00
parent 147e6828d7
commit 063fedd709
2 changed files with 15 additions and 12 deletions

View File

@ -21,10 +21,10 @@ use symbol_map::SymbolId;
/// `f(i)`.
///
/// Elements `j` of `data` for which `f(j)` is `None` are discarded.
fn permute_compact<T, F>(data: &mut Vec<T>, f: F)
where
F: Fn(usize) -> Option<usize>,
{
fn permute_compact<T>(
data: &mut Vec<T>,
f: impl Fn(usize) -> Option<usize>,
) {
if data.is_empty() {
return;
}
@ -91,7 +91,7 @@ where
let empty_states = vec![None; graph.vertices.len()];
let empty_arcs = vec![None; graph.arcs.len()];
Collector {
graph: graph,
graph,
marked_state_count: 0,
marked_arc_count: 0,
state_id_map: empty_states,
@ -265,17 +265,17 @@ mod test {
children: Vec<EdgeId>,
) -> RawVertex<&'static str> {
RawVertex {
data: data,
parents: parents,
children: children,
data,
parents,
children,
}
}
fn make_arc(data: &'static str, source: VertexId, target: VertexId) -> RawEdge<&'static str> {
RawEdge {
data: data,
source: source,
target: target,
data,
source,
target,
}
}

View File

@ -469,7 +469,10 @@ where
/// Deletes all graph components that are not reachable by a traversal
/// starting from each of `roots`.
pub fn retain_reachable_from<I: IntoIterator<Item = NodeRef<'id>>>(self, roots: I) {
pub fn retain_reachable_from(
self,
roots: impl IntoIterator<Item = NodeRef<'id>>,
) {
let root_ids: Vec<VertexId> = roots.into_iter().map(|n| n.id).collect();
self.retain_reachable_from_ids(&root_ids);
}