Skip to content

Commit

Permalink
Test generator: strip generics from function names (#1768)
Browse files Browse the repository at this point in the history
  • Loading branch information
senekor authored Nov 14, 2023
1 parent d111213 commit 22c94f6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion rust-tooling/src/bin/generate_exercise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,14 @@ fn read_fn_names_from_lib_rs(slug: &str) -> Vec<String> {
lib_rs
.split("fn ")
.skip(1)
.map(|f| f.split_once('(').unwrap().0.to_string())
.map(|f| {
let tmp = f.split_once('(').unwrap().0;
// strip generics
if let Some((res, _)) = tmp.split_once('<') {
res.to_string()
} else {
tmp.to_string()
}
})
.collect()
}

0 comments on commit 22c94f6

Please sign in to comment.