-
Notifications
You must be signed in to change notification settings - Fork 898
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some basic tests for chain_width use
- Loading branch information
1 parent
78b0728
commit 58157bb
Showing
6 changed files
with
154 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// rustfmt-chain_width: 1 | ||
// setting an unachievable chain_width to always get chains | ||
// on separate lines | ||
|
||
struct Fluent {} | ||
|
||
impl Fluent { | ||
fn blorp(&self) -> &Self { | ||
self | ||
} | ||
} | ||
|
||
fn main() { | ||
let test = Fluent {}; | ||
|
||
// should be left alone | ||
test.blorp(); | ||
|
||
// should be wrapped | ||
test.blorp().blorp(); | ||
test.blorp().blorp().blorp(); | ||
test.blorp().blorp().blorp().blorp(); | ||
} |
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,23 @@ | ||
// rustfmt-chain_width: 40 | ||
|
||
struct Fluent {} | ||
|
||
impl Fluent { | ||
fn blorp(&self) -> &Self { | ||
self | ||
} | ||
} | ||
|
||
fn main() { | ||
let test = Fluent {}; | ||
|
||
// should not be wrapped | ||
test.blorp(); | ||
test.blorp().blorp(); | ||
test.blorp().blorp().blorp(); | ||
test.blorp().blorp().blorp().blorp(); | ||
|
||
// should be wrapped | ||
test.blorp().blorp().blorp().blorp().blorp(); | ||
test.blorp().blorp().blorp().blorp().blorp().blorp(); | ||
} |
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,21 @@ | ||
// rustfmt-chain_width: 20 | ||
|
||
struct Fluent {} | ||
|
||
impl Fluent { | ||
fn blorp(&self) -> &Self { | ||
self | ||
} | ||
} | ||
|
||
fn main() { | ||
let test = Fluent {}; | ||
|
||
// should not be wrapped | ||
test.blorp(); | ||
test.blorp().blorp(); | ||
|
||
// should be wrapped | ||
test.blorp().blorp().blorp(); | ||
test.blorp().blorp().blorp().blorp(); | ||
} |
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,29 @@ | ||
// rustfmt-chain_width: 1 | ||
// setting an unachievable chain_width to always get chains | ||
// on separate lines | ||
|
||
struct Fluent {} | ||
|
||
impl Fluent { | ||
fn blorp(&self) -> &Self { | ||
self | ||
} | ||
} | ||
|
||
fn main() { | ||
let test = Fluent {}; | ||
|
||
// should be left alone | ||
test.blorp(); | ||
|
||
// should be wrapped | ||
test.blorp() | ||
.blorp(); | ||
test.blorp() | ||
.blorp() | ||
.blorp(); | ||
test.blorp() | ||
.blorp() | ||
.blorp() | ||
.blorp(); | ||
} |
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,32 @@ | ||
// rustfmt-chain_width: 40 | ||
|
||
struct Fluent {} | ||
|
||
impl Fluent { | ||
fn blorp(&self) -> &Self { | ||
self | ||
} | ||
} | ||
|
||
fn main() { | ||
let test = Fluent {}; | ||
|
||
// should not be wrapped | ||
test.blorp(); | ||
test.blorp().blorp(); | ||
test.blorp().blorp().blorp(); | ||
test.blorp().blorp().blorp().blorp(); | ||
|
||
// should be wrapped | ||
test.blorp() | ||
.blorp() | ||
.blorp() | ||
.blorp() | ||
.blorp(); | ||
test.blorp() | ||
.blorp() | ||
.blorp() | ||
.blorp() | ||
.blorp() | ||
.blorp(); | ||
} |
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,26 @@ | ||
// rustfmt-chain_width: 20 | ||
|
||
struct Fluent {} | ||
|
||
impl Fluent { | ||
fn blorp(&self) -> &Self { | ||
self | ||
} | ||
} | ||
|
||
fn main() { | ||
let test = Fluent {}; | ||
|
||
// should not be wrapped | ||
test.blorp(); | ||
test.blorp().blorp(); | ||
|
||
// should be wrapped | ||
test.blorp() | ||
.blorp() | ||
.blorp(); | ||
test.blorp() | ||
.blorp() | ||
.blorp() | ||
.blorp(); | ||
} |