From fa3e3cb6eaa00ce61e3215d8f77eff965dfbbfaf Mon Sep 17 00:00:00 2001 From: flip1995 <9744647+flip1995@users.noreply.github.com> Date: Fri, 7 Sep 2018 17:18:00 +0200 Subject: [PATCH 1/2] Fix #3145 by removing assert --- clippy_lints/src/write.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/clippy_lints/src/write.rs b/clippy_lints/src/write.rs index 7ddae1c81..69d99cc60 100644 --- a/clippy_lints/src/write.rs +++ b/clippy_lints/src/write.rs @@ -284,7 +284,6 @@ fn check_tts<'a>(cx: &EarlyContext<'a>, tts: &ThinTokenStream, is_write: bool) - let mut idx = 0; loop { if !parser.eat(&token::Comma) { - assert!(parser.eat(&token::Eof)); return (Some(fmtstr), expr); } let token_expr = match parser.parse_expr().map_err(|mut err| err.cancel()) { From 90f7997771ca34e699f98c30d519711253c2c148 Mon Sep 17 00:00:00 2001 From: flip1995 <9744647+flip1995@users.noreply.github.com> Date: Fri, 7 Sep 2018 17:18:47 +0200 Subject: [PATCH 2/2] Add regression test --- tests/ui/issue-3145.rs | 3 +++ tests/ui/issue-3145.stderr | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 tests/ui/issue-3145.rs create mode 100644 tests/ui/issue-3145.stderr diff --git a/tests/ui/issue-3145.rs b/tests/ui/issue-3145.rs new file mode 100644 index 000000000..f497d5550 --- /dev/null +++ b/tests/ui/issue-3145.rs @@ -0,0 +1,3 @@ +fn main() { + println!("{}" a); //~ERROR expected token: `,` +} diff --git a/tests/ui/issue-3145.stderr b/tests/ui/issue-3145.stderr new file mode 100644 index 000000000..e289df043 --- /dev/null +++ b/tests/ui/issue-3145.stderr @@ -0,0 +1,8 @@ +error: expected token: `,` + --> $DIR/issue-3145.rs:2:19 + | +2 | println!("{}" a); //~ERROR expected token: `,` + | ^ + +error: aborting due to previous error +