Skip to content

Commit 3b6a5fb

Browse files
Move formatting to different function
This slims down the generator MIR considerably, which makes debugging easier
1 parent 2b0cfa5 commit 3b6a5fb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/test/ui/generator/issue-69039.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@
44

55
use std::ops::{Generator, GeneratorState};
66

7+
fn mkstr(my_name: String, my_mood: String) -> String {
8+
format!("{} is {}", my_name.trim(), my_mood.trim())
9+
}
10+
711
fn my_scenario() -> impl Generator<String, Yield = &'static str, Return = String> {
812
|_arg: String| {
913
let my_name = yield "What is your name?";
1014
let my_mood = yield "How are you feeling?";
11-
format!("{} is {}", my_name.trim(), my_mood.trim())
15+
mkstr(my_name, my_mood)
1216
}
1317
}
1418

0 commit comments

Comments
 (0)