Skip to content

Commit adc258a

Browse files
committed
Clippy
1 parent 3e52b41 commit adc258a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

hugr-passes/src/monomorphize.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -554,9 +554,13 @@ mod test {
554554
}
555555
}
556556

557-
fn list_funcs(h: &Hugr) -> HashMap<&String, (Node, &FuncDefn)> {
557+
fn list_funcs(h: &Hugr) -> HashMap<&str, (Node, &FuncDefn)> {
558558
h.entry_descendants()
559-
.filter_map(|n| h.get_optype(n).as_func_defn().map(|fd| (&fd.name, (n, fd))))
559+
.filter_map(|n| {
560+
h.get_optype(n)
561+
.as_func_defn()
562+
.map(|fd| (fd.name.as_str(), (n, fd)))
563+
})
560564
.collect::<HashMap<_, _>>()
561565
}
562566

@@ -603,12 +607,12 @@ mod test {
603607
let mono_hugr = hugr;
604608

605609
let mut funcs = list_funcs(&mono_hugr);
606-
let (m, _) = funcs.remove(&"id2".to_string()).unwrap();
610+
let (m, _) = funcs.remove(&"id2").unwrap();
607611
assert_eq!(m, mono.handle().node());
608612
assert_eq!(mono_hugr.get_parent(m), Some(mono_hugr.entrypoint()));
609613
// ALAN: TODO: update wrt. mangling policy for name/link_name
610614
for _ in [usize_t(), ity()] {
611-
let (n, _) = funcs.get(&"id".to_string()).unwrap();
615+
let (n, _) = funcs.get(&"id").unwrap();
612616
assert_eq!(mono_hugr.get_parent(*n), Some(m)); // Not lifted to top
613617
}
614618
Ok(())

0 commit comments

Comments
 (0)