Skip to content

Commit 83a8af5

Browse files
author
Esteban Küber
committed
Suggest space separated format str literal
1 parent 8b59fbc commit 83a8af5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/libsyntax_ext/format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt,
728728
Err(mut err) => {
729729
let sugg_fmt = match args.len() {
730730
0 => "{}".to_string(),
731-
_ => format!("{}{{}}", "{}, ".repeat(args.len())),
731+
_ => format!("{}{{}}", "{} ".repeat(args.len())),
732732

733733
};
734734
err.span_suggestion(

src/test/ui/macros/bad_hello.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ LL | println!(3, 4);
1515
| ^
1616
help: you might be missing a string literal to format with
1717
|
18-
LL | println!("{}, {}", 3, 4);
19-
| ^^^^^^^^^
18+
LL | println!("{} {}", 3, 4);
19+
| ^^^^^^^^
2020

2121
error: aborting due to 2 previous errors
2222

0 commit comments

Comments
 (0)