rust/src/test/ui/parser/increment-autofix.fixed

37 lines
711 B
Rust
Raw Normal View History

// run-rustfix
fn post_regular() {
let mut i = 0;
{ let tmp = i; i += 1; tmp }; //~ ERROR Rust has no postfix increment operator
println!("{}", i);
}
fn post_while() {
let mut i = 0;
while { let tmp = i; i += 1; tmp } < 5 {
//~^ ERROR Rust has no postfix increment operator
println!("{}", i);
}
}
fn pre_regular() {
let mut i = 0;
i += 1; //~ ERROR Rust has no prefix increment operator
println!("{}", i);
}
fn pre_while() {
let mut i = 0;
while { i += 1; i } < 5 {
//~^ ERROR Rust has no prefix increment operator
println!("{}", i);
}
}
fn main() {
post_regular();
post_while();
pre_regular();
pre_while();
}