micro fmt changes

This commit is contained in:
Maybe Waffle 2023-02-28 19:28:14 +04:00
parent a4830266b0
commit 031206bc1d
4 changed files with 12 additions and 13 deletions

View File

@ -1368,6 +1368,7 @@ impl<'a> Parser<'a> {
};
self.recover_from_inc_dec(operand_expr, kind, op_span)
}
fn recover_from_inc_dec(
&mut self,
base: P<Expr>,

View File

@ -281,6 +281,7 @@ impl<'a> Parser<'a> {
lhs = self.recover_from_postfix_increment(lhs, op_span, starts_stmt)?;
continue;
}
if self.prev_token == token::BinOp(token::Minus)
&& self.token == token::BinOp(token::Minus)
&& self.prev_token.span.between(self.token.span).is_empty()
@ -606,7 +607,6 @@ impl<'a> Parser<'a> {
let operand_expr = this.parse_dot_or_call_expr(Default::default())?;
this.recover_from_prefix_increment(operand_expr, pre_span, starts_stmt)
}
token::Ident(..) if this.token.is_keyword(kw::Box) => {
make_it!(this, attrs, |this, _| this.parse_box_expr(lo))
}

View File

@ -1,41 +1,39 @@
fn test4() {
fn test0() {
let mut i = 0;
let _ = i + i--; //~ ERROR Rust has no postfix decrement operator
// won't suggest since we can not handle the precedences
}
fn test5() {
fn test1() {
let mut i = 0;
let _ = i-- + i--; //~ ERROR Rust has no postfix decrement operator
}
fn test6() {
fn test2() {
let mut i = 0;
let _ = --i + i--; //~ ERROR Rust has no postfix decrement operator
}
fn test7() {
fn test3() {
let mut i = 0;
let _ = i-- + --i; //~ ERROR Rust has no postfix decrement operator
}
fn test8() {
fn test4() {
let mut i = 0;
let _ = (1 + 2 + i)--; //~ ERROR Rust has no postfix decrement operator
}
fn test9() {
fn test5() {
let mut i = 0;
let _ = (i-- + 1) + 2; //~ ERROR Rust has no postfix decrement operator
}
fn test14(){
fn test6(){
let i=10;
while i!=0{
while i != 0 {
i--; //~ ERROR Rust has no postfix decrement operator
}
}
fn main() { }
fn main() {}

View File

@ -55,7 +55,7 @@ LL | let _ = ({ let tmp = i; i -= 1; tmp } + 1) + 2;
| +++++++++++ ~~~~~~~~~~~~~~~
error: Rust has no postfix decrement operator
--> $DIR/issue-108495-dec.rs:37:10
--> $DIR/issue-108495-dec.rs:35:10
|
LL | i--;
| ^^ not a valid postfix operator