Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added option to configure if/else brace style
- Loading branch information
Showing
8 changed files
with
371 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// rustfmt-else_if_brace_style: AlwaysNextLine | ||
|
||
fn main() { | ||
if false | ||
{ | ||
(); | ||
(); | ||
} | ||
|
||
if false // lone if comment | ||
{ | ||
(); | ||
(); | ||
} | ||
|
||
|
||
let a = | ||
if 0 > 1 { | ||
unreachable!() | ||
} | ||
else | ||
{ | ||
0x0 | ||
}; | ||
|
||
|
||
if true | ||
{ | ||
(); | ||
} else if false { | ||
(); | ||
(); | ||
} | ||
else { | ||
(); | ||
(); | ||
(); | ||
} | ||
|
||
if true // else-if-chain if comment | ||
{ | ||
(); | ||
} | ||
else if false // else-if-chain else-if comment | ||
{ | ||
(); | ||
(); | ||
} else // else-if-chain else comment | ||
{ | ||
(); | ||
(); | ||
(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// rustfmt-else_if_brace_style: AlwaysSameLine | ||
|
||
fn main() { | ||
if false | ||
{ | ||
(); | ||
(); | ||
} | ||
|
||
if false // lone if comment | ||
{ | ||
(); | ||
(); | ||
} | ||
|
||
|
||
let a = | ||
if 0 > 1 { | ||
unreachable!() | ||
} | ||
else | ||
{ | ||
0x0 | ||
}; | ||
|
||
|
||
if true | ||
{ | ||
(); | ||
} else if false { | ||
(); | ||
(); | ||
} | ||
else { | ||
(); | ||
(); | ||
(); | ||
} | ||
|
||
if true // else-if-chain if comment | ||
{ | ||
(); | ||
} | ||
else if false // else-if-chain else-if comment | ||
{ | ||
(); | ||
(); | ||
} else // else-if-chain else comment | ||
{ | ||
(); | ||
(); | ||
(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// rustfmt-else_if_brace_style: ClosingNextLine | ||
|
||
fn main() { | ||
if false | ||
{ | ||
(); | ||
(); | ||
} | ||
|
||
if false // lone if comment | ||
{ | ||
(); | ||
(); | ||
} | ||
|
||
|
||
let a = | ||
if 0 > 1 { | ||
unreachable!() | ||
} | ||
else | ||
{ | ||
0x0 | ||
}; | ||
|
||
|
||
if true | ||
{ | ||
(); | ||
} else if false { | ||
(); | ||
(); | ||
} | ||
else { | ||
(); | ||
(); | ||
(); | ||
} | ||
|
||
if true // else-if-chain if comment | ||
{ | ||
(); | ||
} | ||
else if false // else-if-chain else-if comment | ||
{ | ||
(); | ||
(); | ||
} else // else-if-chain else comment | ||
{ | ||
(); | ||
(); | ||
(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// rustfmt-else_if_brace_style: AlwaysNextLine | ||
|
||
fn main() { | ||
if false | ||
{ | ||
(); | ||
(); | ||
} | ||
|
||
if false | ||
// lone if comment | ||
{ | ||
(); | ||
(); | ||
} | ||
|
||
|
||
let a = if 0 > 1 | ||
{ | ||
unreachable!() | ||
} | ||
else | ||
{ | ||
0x0 | ||
}; | ||
|
||
|
||
if true | ||
{ | ||
(); | ||
} | ||
else if false | ||
{ | ||
(); | ||
(); | ||
} | ||
else | ||
{ | ||
(); | ||
(); | ||
(); | ||
} | ||
|
||
if true | ||
// else-if-chain if comment | ||
{ | ||
(); | ||
} | ||
else if false | ||
// else-if-chain else-if comment | ||
{ | ||
(); | ||
(); | ||
} | ||
else | ||
// else-if-chain else comment | ||
{ | ||
(); | ||
(); | ||
(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// rustfmt-else_if_brace_style: AlwaysSameLine | ||
|
||
fn main() { | ||
if false { | ||
(); | ||
(); | ||
} | ||
|
||
if false | ||
// lone if comment | ||
{ | ||
(); | ||
(); | ||
} | ||
|
||
|
||
let a = if 0 > 1 { | ||
unreachable!() | ||
} else { | ||
0x0 | ||
}; | ||
|
||
|
||
if true { | ||
(); | ||
} else if false { | ||
(); | ||
(); | ||
} else { | ||
(); | ||
(); | ||
(); | ||
} | ||
|
||
if true | ||
// else-if-chain if comment | ||
{ | ||
(); | ||
} else if false | ||
// else-if-chain else-if comment | ||
{ | ||
(); | ||
(); | ||
} else | ||
// else-if-chain else comment | ||
{ | ||
(); | ||
(); | ||
(); | ||
} | ||
} |
Oops, something went wrong.