Skip to content

Commit 67739c3

Browse files
authored
Merge pull request #1998 from Kobzol/cmd-refactor
Apply forgotten review changes to command parsing
2 parents e19c968 + 7c5fe16 commit 67739c3

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

site/src/request_handlers/github.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,9 @@ async fn handle_rust_timer(
137137
return Ok(github::Response);
138138
}
139139

140-
let build_cmds: Vec<_> = parse_build_commands(&comment.body).collect();
141140
let mut valid_build_cmds = vec![];
142141
let mut errors = String::new();
143-
for cmd in build_cmds {
142+
for cmd in parse_build_commands(&comment.body) {
144143
match cmd {
145144
Ok(cmd) => valid_build_cmds.push(cmd),
146145
Err(error) => errors.push_str(&format!("Cannot parse build command: {error}\n")),
@@ -208,18 +207,15 @@ fn parse_build_commands(body: &str) -> impl Iterator<Item = Result<BuildCommand,
208207
})
209208
}
210209

211-
fn get_command_lines<'a: 'b, 'b>(
212-
body: &'a str,
213-
command: &'b str,
214-
) -> impl Iterator<Item = &'a str> + 'b {
210+
fn get_command_lines<'a>(body: &'a str, command: &'a str) -> impl Iterator<Item = &'a str> {
215211
let prefix = "@rust-timer";
216212
body.lines()
217213
.filter_map(move |line| {
218214
line.find(prefix)
219215
.map(|index| line[index + prefix.len()..].trim())
220216
})
221217
.filter_map(move |line| line.strip_prefix(command))
222-
.map(move |l| l.trim_start())
218+
.map(|l| l.trim_start())
223219
}
224220

225221
fn parse_benchmark_parameters<'a>(

0 commit comments

Comments
 (0)