Fixed 'Incorrect comment indent inside if/else' issue. (#4459)
* Added test cases * Fixed if condition comment issue * Fixed extern C issue * Removed previous test case * Removed tmp file * honor the authors intent * Changed the file name to its original name * Removed extra whitespace
This commit is contained in:
parent
ce13ff15c3
commit
faf97a67d6
4 changed files with 199 additions and 12 deletions
85
tests/source/issue-4120.rs
Normal file
85
tests/source/issue-4120.rs
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
fn main() {
|
||||
let x = if true {
|
||||
1
|
||||
// In if
|
||||
} else {
|
||||
0
|
||||
// In else
|
||||
};
|
||||
|
||||
let x = if true {
|
||||
1
|
||||
/* In if */
|
||||
} else {
|
||||
0
|
||||
/* In else */
|
||||
};
|
||||
|
||||
let z = if true {
|
||||
if true {
|
||||
1
|
||||
|
||||
// In if level 2
|
||||
} else {
|
||||
2
|
||||
}
|
||||
} else {
|
||||
3
|
||||
};
|
||||
|
||||
let a = if true {
|
||||
1
|
||||
// In if
|
||||
} else {
|
||||
0
|
||||
// In else
|
||||
};
|
||||
|
||||
let a = if true {
|
||||
1
|
||||
|
||||
// In if
|
||||
} else {
|
||||
0
|
||||
// In else
|
||||
};
|
||||
|
||||
let b = if true {
|
||||
1
|
||||
|
||||
// In if
|
||||
} else {
|
||||
0
|
||||
// In else
|
||||
};
|
||||
|
||||
let c = if true {
|
||||
1
|
||||
|
||||
// In if
|
||||
} else {
|
||||
0
|
||||
// In else
|
||||
};
|
||||
for i in 0..2 {
|
||||
println!("Something");
|
||||
// In for
|
||||
}
|
||||
|
||||
for i in 0..2 {
|
||||
println!("Something");
|
||||
/* In for */
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
fn first();
|
||||
|
||||
// In foreign mod
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
fn first();
|
||||
|
||||
/* In foreign mod */
|
||||
}
|
||||
}
|
||||
85
tests/target/issue-4120.rs
Normal file
85
tests/target/issue-4120.rs
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
fn main() {
|
||||
let x = if true {
|
||||
1
|
||||
// In if
|
||||
} else {
|
||||
0
|
||||
// In else
|
||||
};
|
||||
|
||||
let x = if true {
|
||||
1
|
||||
/* In if */
|
||||
} else {
|
||||
0
|
||||
/* In else */
|
||||
};
|
||||
|
||||
let z = if true {
|
||||
if true {
|
||||
1
|
||||
|
||||
// In if level 2
|
||||
} else {
|
||||
2
|
||||
}
|
||||
} else {
|
||||
3
|
||||
};
|
||||
|
||||
let a = if true {
|
||||
1
|
||||
// In if
|
||||
} else {
|
||||
0
|
||||
// In else
|
||||
};
|
||||
|
||||
let a = if true {
|
||||
1
|
||||
|
||||
// In if
|
||||
} else {
|
||||
0
|
||||
// In else
|
||||
};
|
||||
|
||||
let b = if true {
|
||||
1
|
||||
|
||||
// In if
|
||||
} else {
|
||||
0
|
||||
// In else
|
||||
};
|
||||
|
||||
let c = if true {
|
||||
1
|
||||
|
||||
// In if
|
||||
} else {
|
||||
0
|
||||
// In else
|
||||
};
|
||||
for i in 0..2 {
|
||||
println!("Something");
|
||||
// In for
|
||||
}
|
||||
|
||||
for i in 0..2 {
|
||||
println!("Something");
|
||||
/* In for */
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
fn first();
|
||||
|
||||
// In foreign mod
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
fn first();
|
||||
|
||||
/* In foreign mod */
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue