Fix items_after_statements for consts

This commit is contained in:
Devon Hollowood 2018-10-07 17:08:20 -07:00
parent be983fbf52
commit 82638e4dd4

View file

@ -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;