From 82638e4dd42274dd1c644197b9dc821aa3409c97 Mon Sep 17 00:00:00 2001 From: Devon Hollowood Date: Sun, 7 Oct 2018 17:08:20 -0700 Subject: [PATCH] Fix items_after_statements for `const`s --- clippy_lints/src/write.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/clippy_lints/src/write.rs b/clippy_lints/src/write.rs index 06575a264..1fa7c50bb 100644 --- a/clippy_lints/src/write.rs +++ b/clippy_lints/src/write.rs @@ -283,13 +283,6 @@ fn check_tts<'a>(cx: &EarlyContext<'a>, tts: &ThinTokenStream, is_write: bool) - let lint = if is_write { WRITE_LITERAL } else { PRINT_LITERAL }; let mut idx = 0; loop { - if !parser.eat(&token::Comma) { - return (Some(fmtstr), expr); - } - let token_expr = match parser.parse_expr().map_err(|mut err| err.cancel()) { - Ok(expr) => expr, - Err(_) => return (Some(fmtstr), None), - }; const SIMPLE: FormatSpec<'_> = FormatSpec { fill: None, align: AlignUnknown, @@ -298,6 +291,13 @@ fn check_tts<'a>(cx: &EarlyContext<'a>, tts: &ThinTokenStream, is_write: bool) - width: CountImplied, ty: "", }; + if !parser.eat(&token::Comma) { + return (Some(fmtstr), expr); + } + let token_expr = match parser.parse_expr().map_err(|mut err| err.cancel()) { + Ok(expr) => expr, + Err(_) => return (Some(fmtstr), None), + }; match &token_expr.node { ExprKind::Lit(_) => { let mut all_simple = true;