Add source/target tests for each config option
This commit is contained in:
parent
b4833a8c58
commit
16b91be3e6
6
tests/source/configs-array_layout-block.rs
Normal file
6
tests/source/configs-array_layout-block.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-array_layout: Block
|
||||
// Array layout
|
||||
|
||||
fn main() {
|
||||
let lorem = vec!["ipsum","dolor","sit","amet","consectetur","adipiscing","elit"];
|
||||
}
|
6
tests/source/configs-array_layout-visual.rs
Normal file
6
tests/source/configs-array_layout-visual.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-array_layout: Visual
|
||||
// Array layout
|
||||
|
||||
fn main() {
|
||||
let lorem = vec!["ipsum","dolor","sit","amet","consectetur","adipiscing","elit"];
|
||||
}
|
6
tests/source/configs-array_width-above.rs
Normal file
6
tests/source/configs-array_width-above.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-array_width: 10
|
||||
// Array width
|
||||
|
||||
fn main() {
|
||||
let lorem = vec!["ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"];
|
||||
}
|
6
tests/source/configs-array_width-below.rs
Normal file
6
tests/source/configs-array_width-below.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-array_width: 100
|
||||
// Array width
|
||||
|
||||
fn main() {
|
||||
let lorem = vec!["ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"];
|
||||
}
|
6
tests/source/configs-chain_indent-block.rs
Normal file
6
tests/source/configs-chain_indent-block.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-chain_indent: Block
|
||||
// Chain indent
|
||||
|
||||
fn main() {
|
||||
let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elit();
|
||||
}
|
6
tests/source/configs-chain_indent-visual.rs
Normal file
6
tests/source/configs-chain_indent-visual.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-chain_indent: Visual
|
||||
// Chain indent
|
||||
|
||||
fn main() {
|
||||
let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elit();
|
||||
}
|
6
tests/source/configs-chain_one_line_max-above.rs
Normal file
6
tests/source/configs-chain_one_line_max-above.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-chain_one_line_max: 10
|
||||
// Chain one line max
|
||||
|
||||
fn main() {
|
||||
let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elit();
|
||||
}
|
6
tests/source/configs-chain_one_line_max-below.rs
Normal file
6
tests/source/configs-chain_one_line_max-below.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-chain_one_line_max: 100
|
||||
// Chain one line max
|
||||
|
||||
fn main() {
|
||||
let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elit();
|
||||
}
|
12
tests/source/configs-closure_block_indent_threshold-10.rs
Normal file
12
tests/source/configs-closure_block_indent_threshold-10.rs
Normal file
@ -0,0 +1,12 @@
|
||||
// rustfmt-closure_block_indent_threshold: 10
|
||||
// Closure block indent threshold
|
||||
|
||||
fn main() {
|
||||
lorem_ipsum(|| {
|
||||
println!("lorem");
|
||||
println!("ipsum");
|
||||
println!("dolor");
|
||||
println!("sit");
|
||||
println!("amet");
|
||||
});
|
||||
}
|
12
tests/source/configs-closure_block_indent_threshold-2.rs
Normal file
12
tests/source/configs-closure_block_indent_threshold-2.rs
Normal file
@ -0,0 +1,12 @@
|
||||
// rustfmt-closure_block_indent_threshold: 2
|
||||
// Closure block indent threshold
|
||||
|
||||
fn main() {
|
||||
lorem_ipsum(|| {
|
||||
println!("lorem");
|
||||
println!("ipsum");
|
||||
println!("dolor");
|
||||
println!("sit");
|
||||
println!("amet");
|
||||
});
|
||||
}
|
7
tests/source/configs-comment_width-above.rs
Normal file
7
tests/source/configs-comment_width-above.rs
Normal file
@ -0,0 +1,7 @@
|
||||
// rustfmt-comment_width: 40
|
||||
// rustfmt-wrap_comments: true
|
||||
// Comment width
|
||||
|
||||
fn main() {
|
||||
// Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
}
|
7
tests/source/configs-comment_width-below.rs
Normal file
7
tests/source/configs-comment_width-below.rs
Normal file
@ -0,0 +1,7 @@
|
||||
// rustfmt-comment_width: 80
|
||||
// rustfmt-wrap_comments: true
|
||||
// Comment width
|
||||
|
||||
fn main() {
|
||||
// Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
}
|
7
tests/source/configs-comment_width-ignore.rs
Normal file
7
tests/source/configs-comment_width-ignore.rs
Normal file
@ -0,0 +1,7 @@
|
||||
// rustfmt-comment_width: 40
|
||||
// rustfmt-wrap_comments: false
|
||||
// Comment width
|
||||
|
||||
fn main() {
|
||||
// Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
}
|
6
tests/source/configs-condense_wildcard_suffices-false.rs
Normal file
6
tests/source/configs-condense_wildcard_suffices-false.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-condense_wildcard_suffices: false
|
||||
// Condense wildcard suffices
|
||||
|
||||
fn main() {
|
||||
let (lorem, ipsum, _, _) = (1, 2, 3, 4);
|
||||
}
|
6
tests/source/configs-condense_wildcard_suffices-true.rs
Normal file
6
tests/source/configs-condense_wildcard_suffices-true.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-condense_wildcard_suffices: true
|
||||
// Condense wildcard suffices
|
||||
|
||||
fn main() {
|
||||
let (lorem, ipsum, _, _) = (1, 2, 3, 4);
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
// rustfmt-control_brace_style: AlwaysNextLine
|
||||
// Control brace style
|
||||
|
||||
fn main() {
|
||||
if lorem { println!("ipsum!"); } else { println!("dolor!"); }
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
// rustfmt-control_brace_style: AlwaysSameLine
|
||||
// Control brace style
|
||||
|
||||
fn main() {
|
||||
if lorem { println!("ipsum!"); } else { println!("dolor!"); }
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
// rustfmt-control_brace_style: ClosingNextLine
|
||||
// Control brace style
|
||||
|
||||
fn main() {
|
||||
if lorem { println!("ipsum!"); } else { println!("dolor!"); }
|
||||
}
|
6
tests/source/configs-disable_all_formatting-false.rs
Normal file
6
tests/source/configs-disable_all_formatting-false.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-disable_all_formatting: false
|
||||
// Disable all formatting
|
||||
|
||||
fn main() {
|
||||
if lorem{println!("ipsum!");}else{println!("dolor!");}
|
||||
}
|
6
tests/source/configs-disable_all_formatting-true.rs
Normal file
6
tests/source/configs-disable_all_formatting-true.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-disable_all_formatting: true
|
||||
// Disable all formatting
|
||||
|
||||
fn main() {
|
||||
iflorem{println!("ipsum!");}else{println!("dolor!");}
|
||||
}
|
6
tests/source/configs-error_on_line_overflow-false.rs
Normal file
6
tests/source/configs-error_on_line_overflow-false.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
// Error on line overflow
|
||||
|
||||
fn main() {
|
||||
let lorem_ipsum_dolor_sit_amet_consectetur_adipiscing_elit_lorem_ipsum_dolor_sit_amet_consectetur_adipiscing_elit;
|
||||
}
|
16
tests/source/configs-fn_args_density-compressed.rs
Normal file
16
tests/source/configs-fn_args_density-compressed.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// rustfmt-fn_args_density: Compressed
|
||||
// Function arguments density
|
||||
|
||||
trait Lorem {
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
|
||||
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
|
||||
// body
|
||||
}
|
||||
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, adipiscing: Adipiscing, elit: Elit);
|
||||
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, adipiscing: Adipiscing, elit: Elit) {
|
||||
// body
|
||||
}
|
||||
}
|
20
tests/source/configs-fn_args_density-compressed_if_empty.rs
Normal file
20
tests/source/configs-fn_args_density-compressed_if_empty.rs
Normal file
@ -0,0 +1,20 @@
|
||||
// rustfmt-fn_args_density: CompressedIfEmpty
|
||||
// Function arguments density
|
||||
|
||||
trait Lorem {
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
|
||||
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
|
||||
// body
|
||||
}
|
||||
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, adipiscing: Adipiscing, elit: Elit);
|
||||
|
||||
// FIXME: Previous line should be formatted like this:
|
||||
// fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur,
|
||||
// adipiscing: Adipiscing, elit: Elit);
|
||||
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, adipiscing: Adipiscing, elit: Elit) {
|
||||
// body
|
||||
}
|
||||
}
|
16
tests/source/configs-fn_args_density-tall.rs
Normal file
16
tests/source/configs-fn_args_density-tall.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// rustfmt-fn_args_density: Tall
|
||||
// Function arguments density
|
||||
|
||||
trait Lorem {
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
|
||||
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
|
||||
// body
|
||||
}
|
||||
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, adipiscing: Adipiscing, elit: Elit);
|
||||
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, adipiscing: Adipiscing, elit: Elit) {
|
||||
// body
|
||||
}
|
||||
}
|
16
tests/source/configs-fn_args_density-vertical.rs
Normal file
16
tests/source/configs-fn_args_density-vertical.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// rustfmt-fn_args_density: Vertical
|
||||
// Function arguments density
|
||||
|
||||
trait Lorem {
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
|
||||
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
|
||||
// body
|
||||
}
|
||||
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, adipiscing: Adipiscing, elit: Elit);
|
||||
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, adipiscing: Adipiscing, elit: Elit) {
|
||||
// body
|
||||
}
|
||||
}
|
10
tests/source/configs-fn_args_layout-block.rs
Normal file
10
tests/source/configs-fn_args_layout-block.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// rustfmt-fn_args_layout: Block
|
||||
// Function arguments layout
|
||||
|
||||
fn lorem() {}
|
||||
|
||||
fn lorem(ipsum: usize) {}
|
||||
|
||||
fn lorem(ipsum: usize, dolor: usize, sit: usize, amet: usize, consectetur: usize, adipiscing: usize, elit: usize) {
|
||||
// body
|
||||
}
|
10
tests/source/configs-fn_args_layout-visual.rs
Normal file
10
tests/source/configs-fn_args_layout-visual.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// rustfmt-fn_args_layout: Visual
|
||||
// Function arguments layout
|
||||
|
||||
fn lorem() {}
|
||||
|
||||
fn lorem(ipsum: usize) {}
|
||||
|
||||
fn lorem(ipsum: usize, dolor: usize, sit: usize, amet: usize, consectetur: usize, adipiscing: usize, elit: usize) {
|
||||
// body
|
||||
}
|
6
tests/source/configs-fn_args_paren_newline-false.rs
Normal file
6
tests/source/configs-fn_args_paren_newline-false.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-fn_args_paren_newline: false
|
||||
// Function arguments parenthesis on a newline
|
||||
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) -> DolorSitAmetConsecteturAdipiscingElitLoremIpsumDolorSitAmetConsecteturAdipiscingElit {
|
||||
// body
|
||||
}
|
6
tests/source/configs-fn_args_paren_newline-true.rs
Normal file
6
tests/source/configs-fn_args_paren_newline-true.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-fn_args_paren_newline: true
|
||||
// Function arguments parenthesis on a newline
|
||||
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) -> DolorSitAmetConsecteturAdipiscingElitLoremIpsumDolorSitAmetConsecteturAdipiscingElit {
|
||||
// body
|
||||
}
|
14
tests/source/configs-fn_brace_style-always_next_line.rs
Normal file
14
tests/source/configs-fn_brace_style-always_next_line.rs
Normal file
@ -0,0 +1,14 @@
|
||||
// rustfmt-fn_brace_style: AlwaysNextLine
|
||||
// Function brace style
|
||||
|
||||
fn lorem() {
|
||||
// body
|
||||
}
|
||||
|
||||
fn lorem(ipsum: usize) {
|
||||
// body
|
||||
}
|
||||
|
||||
fn lorem<T>(ipsum: T) where T: Add + Sub + Mul + Div {
|
||||
// body
|
||||
}
|
14
tests/source/configs-fn_brace_style-prefer_same_line.rs
Normal file
14
tests/source/configs-fn_brace_style-prefer_same_line.rs
Normal file
@ -0,0 +1,14 @@
|
||||
// rustfmt-fn_brace_style: PreferSameLine
|
||||
// Function brace style
|
||||
|
||||
fn lorem() {
|
||||
// body
|
||||
}
|
||||
|
||||
fn lorem(ipsum: usize) {
|
||||
// body
|
||||
}
|
||||
|
||||
fn lorem<T>(ipsum: T) where T: Add + Sub + Mul + Div {
|
||||
// body
|
||||
}
|
14
tests/source/configs-fn_brace_style-same_line_where.rs
Normal file
14
tests/source/configs-fn_brace_style-same_line_where.rs
Normal file
@ -0,0 +1,14 @@
|
||||
// rustfmt-fn_brace_style: SameLineWhere
|
||||
// Function brace style
|
||||
|
||||
fn lorem() {
|
||||
// body
|
||||
}
|
||||
|
||||
fn lorem(ipsum: usize) {
|
||||
// body
|
||||
}
|
||||
|
||||
fn lorem<T>(ipsum: T) where T: Add + Sub + Mul + Div {
|
||||
// body
|
||||
}
|
6
tests/source/configs-fn_call_style-block.rs
Normal file
6
tests/source/configs-fn_call_style-block.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-fn_call_style: Block
|
||||
// Function call style
|
||||
|
||||
fn main() {
|
||||
lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit");
|
||||
}
|
6
tests/source/configs-fn_call_style-visual.rs
Normal file
6
tests/source/configs-fn_call_style-visual.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-fn_call_style: Visual
|
||||
// Function call style
|
||||
|
||||
fn main() {
|
||||
lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit");
|
||||
}
|
6
tests/source/configs-fn_call_width-above.rs
Normal file
6
tests/source/configs-fn_call_width-above.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-fn_call_width: 10
|
||||
// Function call width
|
||||
|
||||
fn main() {
|
||||
lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit");
|
||||
}
|
6
tests/source/configs-fn_call_width-below.rs
Normal file
6
tests/source/configs-fn_call_width-below.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-fn_call_width: 100
|
||||
// Function call width
|
||||
|
||||
fn main() {
|
||||
lorem("lorem", "ipsum", "dolor");
|
||||
}
|
9
tests/source/configs-fn_empty_single_line-false.rs
Normal file
9
tests/source/configs-fn_empty_single_line-false.rs
Normal file
@ -0,0 +1,9 @@
|
||||
// rustfmt-fn_empty_single_line: false
|
||||
// Empty function on single line
|
||||
|
||||
fn lorem() {
|
||||
}
|
||||
|
||||
fn lorem() {
|
||||
|
||||
}
|
9
tests/source/configs-fn_empty_single_line-true.rs
Normal file
9
tests/source/configs-fn_empty_single_line-true.rs
Normal file
@ -0,0 +1,9 @@
|
||||
// rustfmt-fn_empty_single_line: true
|
||||
// Empty function on single line
|
||||
|
||||
fn lorem() {
|
||||
}
|
||||
|
||||
fn lorem() {
|
||||
|
||||
}
|
6
tests/source/configs-fn_return_indent-with_args.rs
Normal file
6
tests/source/configs-fn_return_indent-with_args.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-fn_return_indent: WithArgs
|
||||
// Function return type indent
|
||||
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur, adipiscing: Adipiscing) -> Elit where Ipsum: Eq {
|
||||
// body
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
// rustfmt-fn_return_indent: WithWhereClause
|
||||
// Function return type indent
|
||||
|
||||
fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur, adipiscing: Adipiscing) -> Elit where Ipsum: Eq {
|
||||
// body
|
||||
}
|
11
tests/source/configs-fn_single_line-false.rs
Normal file
11
tests/source/configs-fn_single_line-false.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// rustfmt-fn_single_line: false
|
||||
// Single-expression function on single line
|
||||
|
||||
fn lorem() -> usize {
|
||||
42
|
||||
}
|
||||
|
||||
fn lorem() -> usize {
|
||||
let ipsum = 42;
|
||||
ipsum
|
||||
}
|
11
tests/source/configs-fn_single_line-true.rs
Normal file
11
tests/source/configs-fn_single_line-true.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// rustfmt-fn_single_line: true
|
||||
// Single-expression function on single line
|
||||
|
||||
fn lorem() -> usize {
|
||||
42
|
||||
}
|
||||
|
||||
fn lorem() -> usize {
|
||||
let ipsum = 42;
|
||||
ipsum
|
||||
}
|
6
tests/source/configs-force_explicit_abi-false.rs
Normal file
6
tests/source/configs-force_explicit_abi-false.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-force_explicit_abi: false
|
||||
// Force explicit abi
|
||||
|
||||
extern {
|
||||
pub static lorem: c_int;
|
||||
}
|
6
tests/source/configs-force_explicit_abi-true.rs
Normal file
6
tests/source/configs-force_explicit_abi-true.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-force_explicit_abi: true
|
||||
// Force explicit abi
|
||||
|
||||
extern {
|
||||
pub static lorem: c_int;
|
||||
}
|
9
tests/source/configs-force_format_strings-false.rs
Normal file
9
tests/source/configs-force_format_strings-false.rs
Normal file
@ -0,0 +1,9 @@
|
||||
// rustfmt-force_format_strings: false
|
||||
// rustfmt-format_strings: false
|
||||
// rustfmt-max_width: 50
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
// Force format strings
|
||||
|
||||
fn main() {
|
||||
let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit";
|
||||
}
|
8
tests/source/configs-force_format_strings-true.rs
Normal file
8
tests/source/configs-force_format_strings-true.rs
Normal file
@ -0,0 +1,8 @@
|
||||
// rustfmt-force_format_strings: true
|
||||
// rustfmt-format_strings: false
|
||||
// rustfmt-max_width: 50
|
||||
// Force format strings
|
||||
|
||||
fn main() {
|
||||
let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit";
|
||||
}
|
8
tests/source/configs-format_strings-false.rs
Normal file
8
tests/source/configs-format_strings-false.rs
Normal file
@ -0,0 +1,8 @@
|
||||
// rustfmt-format_strings: false
|
||||
// rustfmt-max_width: 50
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
// Force format strings
|
||||
|
||||
fn main() {
|
||||
let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit";
|
||||
}
|
7
tests/source/configs-format_strings-true.rs
Normal file
7
tests/source/configs-format_strings-true.rs
Normal file
@ -0,0 +1,7 @@
|
||||
// rustfmt-format_strings: true
|
||||
// rustfmt-max_width: 50
|
||||
// Force format strings
|
||||
|
||||
fn main() {
|
||||
let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit";
|
||||
}
|
6
tests/source/configs-generics_indent-block.rs
Normal file
6
tests/source/configs-generics_indent-block.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-generics_indent: Block
|
||||
// Generics indent
|
||||
|
||||
fn lorem<Ipsum: Eq = usize, Dolor: Eq = usize, Sit: Eq = usize, Amet: Eq = usize, Adipiscing: Eq = usize, Consectetur: Eq = usize, Elit: Eq = usize>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, adipiscing: Adipiscing, consectetur: Consectetur, elit: Elit) -> T {
|
||||
// body
|
||||
}
|
6
tests/source/configs-generics_indent-visual.rs
Normal file
6
tests/source/configs-generics_indent-visual.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-generics_indent: Visual
|
||||
// Generics indent
|
||||
|
||||
fn lorem<Ipsum: Eq = usize, Dolor: Eq = usize, Sit: Eq = usize, Amet: Eq = usize, Adipiscing: Eq = usize, Consectetur: Eq = usize, Elit: Eq = usize>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, adipiscing: Adipiscing, consectetur: Consectetur, elit: Elit) -> T {
|
||||
// body
|
||||
}
|
6
tests/source/configs-hard_tabs-false.rs
Normal file
6
tests/source/configs-hard_tabs-false.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-hard_tabs: false
|
||||
// Hard tabs
|
||||
|
||||
fn lorem() -> usize {
|
||||
42 // spaces before 42
|
||||
}
|
6
tests/source/configs-hard_tabs-true.rs
Normal file
6
tests/source/configs-hard_tabs-true.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-hard_tabs: true
|
||||
// Hard tabs
|
||||
|
||||
fn lorem() -> usize {
|
||||
42 // spaces before 42
|
||||
}
|
10
tests/source/configs-impl_empty_single_line-false.rs
Normal file
10
tests/source/configs-impl_empty_single_line-false.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// rustfmt-impl_empty_single_line: false
|
||||
// Empty impl on single line
|
||||
|
||||
impl Lorem {
|
||||
|
||||
}
|
||||
|
||||
impl Ipsum {
|
||||
|
||||
}
|
10
tests/source/configs-impl_empty_single_line-true.rs
Normal file
10
tests/source/configs-impl_empty_single_line-true.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// rustfmt-impl_empty_single_line: true
|
||||
// Empty impl on single line
|
||||
|
||||
impl Lorem {
|
||||
|
||||
}
|
||||
|
||||
impl Ipsum {
|
||||
|
||||
}
|
8
tests/source/configs-indent_match_arms-false.rs
Normal file
8
tests/source/configs-indent_match_arms-false.rs
Normal file
@ -0,0 +1,8 @@
|
||||
// rustfmt-indent_match_arms: false
|
||||
// Indent match arms
|
||||
|
||||
fn main() {
|
||||
match lorem {
|
||||
Lorem::Ipsum => (), Lorem::Dolor => (), Lorem::Sit => (), Lorem::Amet => (),
|
||||
}
|
||||
}
|
8
tests/source/configs-indent_match_arms-true.rs
Normal file
8
tests/source/configs-indent_match_arms-true.rs
Normal file
@ -0,0 +1,8 @@
|
||||
// rustfmt-indent_match_arms: true
|
||||
// Indent match arms
|
||||
|
||||
fn main() {
|
||||
match lorem {
|
||||
Lorem::Ipsum => (), Lorem::Dolor => (), Lorem::Sit => (), Lorem::Amet => (),
|
||||
}
|
||||
}
|
10
tests/source/configs-item_brace_style-always_next_line.rs
Normal file
10
tests/source/configs-item_brace_style-always_next_line.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// rustfmt-item_brace_style: AlwaysNextLine
|
||||
// Item brace style
|
||||
|
||||
struct Lorem {
|
||||
ipsum: bool,
|
||||
}
|
||||
|
||||
struct Dolor<T> where T: Eq {
|
||||
sit: T,
|
||||
}
|
10
tests/source/configs-item_brace_style-prefer_same_line.rs
Normal file
10
tests/source/configs-item_brace_style-prefer_same_line.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// rustfmt-item_brace_style: PreferSameLine
|
||||
// Item brace style
|
||||
|
||||
struct Lorem {
|
||||
ipsum: bool,
|
||||
}
|
||||
|
||||
struct Dolor<T> where T: Eq {
|
||||
sit: T,
|
||||
}
|
10
tests/source/configs-item_brace_style-same_line_where.rs
Normal file
10
tests/source/configs-item_brace_style-same_line_where.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// rustfmt-item_brace_style: SameLineWhere
|
||||
// Item brace style
|
||||
|
||||
struct Lorem {
|
||||
ipsum: bool,
|
||||
}
|
||||
|
||||
struct Dolor<T> where T: Eq {
|
||||
sit: T,
|
||||
}
|
11
tests/source/configs-match_block_trailing_comma-false.rs
Normal file
11
tests/source/configs-match_block_trailing_comma-false.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// rustfmt-match_block_trailing_comma: false
|
||||
// Match block trailing comma
|
||||
|
||||
fn main() {
|
||||
match lorem {
|
||||
Lorem::Ipsum => {
|
||||
println!("ipsum");
|
||||
}
|
||||
Lorem::Dolor => println!("dolor"),
|
||||
}
|
||||
}
|
11
tests/source/configs-match_block_trailing_comma-true.rs
Normal file
11
tests/source/configs-match_block_trailing_comma-true.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// rustfmt-match_block_trailing_comma: true
|
||||
// Match block trailing comma
|
||||
|
||||
fn main() {
|
||||
match lorem {
|
||||
Lorem::Ipsum => {
|
||||
println!("ipsum");
|
||||
}
|
||||
Lorem::Dolor => println!("dolor"),
|
||||
}
|
||||
}
|
8
tests/source/configs-normalize_comments-false.rs
Normal file
8
tests/source/configs-normalize_comments-false.rs
Normal file
@ -0,0 +1,8 @@
|
||||
// rustfmt-normalize_comments: false
|
||||
// Normalize comments
|
||||
|
||||
// Lorem ipsum:
|
||||
fn dolor() -> usize {}
|
||||
|
||||
/* sit amet: */
|
||||
fn adipiscing() -> usize {}
|
8
tests/source/configs-normalize_comments-true.rs
Normal file
8
tests/source/configs-normalize_comments-true.rs
Normal file
@ -0,0 +1,8 @@
|
||||
// rustfmt-normalize_comments: true
|
||||
// Normalize comments
|
||||
|
||||
// Lorem ipsum:
|
||||
fn dolor() -> usize {}
|
||||
|
||||
/* sit amet: */
|
||||
fn adipiscing() -> usize {}
|
4
tests/source/configs-reorder_imported_names-false.rs
Normal file
4
tests/source/configs-reorder_imported_names-false.rs
Normal file
@ -0,0 +1,4 @@
|
||||
// rustfmt-reorder_imported_names: false
|
||||
// Reorder imported names
|
||||
|
||||
use super::{lorem, ipsum, dolor, sit};
|
4
tests/source/configs-reorder_imported_names-true.rs
Normal file
4
tests/source/configs-reorder_imported_names-true.rs
Normal file
@ -0,0 +1,4 @@
|
||||
// rustfmt-reorder_imported_names: true
|
||||
// Reorder imported names
|
||||
|
||||
use super::{lorem, ipsum, dolor, sit};
|
7
tests/source/configs-reorder_imports-false.rs
Normal file
7
tests/source/configs-reorder_imports-false.rs
Normal file
@ -0,0 +1,7 @@
|
||||
// rustfmt-reorder_imports: false
|
||||
// Reorder imports
|
||||
|
||||
use lorem;
|
||||
use ipsum;
|
||||
use dolor;
|
||||
use sit;
|
7
tests/source/configs-reorder_imports-true.rs
Normal file
7
tests/source/configs-reorder_imports-true.rs
Normal file
@ -0,0 +1,7 @@
|
||||
// rustfmt-reorder_imports: true
|
||||
// Reorder imports
|
||||
|
||||
use lorem;
|
||||
use ipsum;
|
||||
use dolor;
|
||||
use sit;
|
@ -0,0 +1,6 @@
|
||||
// rustfmt-single_line_if_else_max_width: 10
|
||||
// Single line if-else max width
|
||||
|
||||
fn main() {
|
||||
let lorem = if ipsum { dolor } else { sit };
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
// rustfmt-single_line_if_else_max_width: 100
|
||||
// Single line if-else max width
|
||||
|
||||
fn main() {
|
||||
let lorem = if ipsum { dolor } else { sit };
|
||||
}
|
6
tests/source/configs-space_after_bound_colon-false.rs
Normal file
6
tests/source/configs-space_after_bound_colon-false.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-space_after_bound_colon: false
|
||||
// Space after bound colon
|
||||
|
||||
fn lorem<T:Eq>(t:T) {
|
||||
// body
|
||||
}
|
6
tests/source/configs-space_after_bound_colon-true.rs
Normal file
6
tests/source/configs-space_after_bound_colon-true.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-space_after_bound_colon: true
|
||||
// Space after bound colon
|
||||
|
||||
fn lorem<T:Eq>(t:T) {
|
||||
// body
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
// rustfmt-space_after_type_annotation_colon: false
|
||||
// Space after type annotation colon
|
||||
|
||||
fn lorem<T:Eq>(t:T) {
|
||||
let ipsum:Dolor = sit;
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
// rustfmt-space_after_type_annotation_colon: true
|
||||
// Space after type annotation colon
|
||||
|
||||
fn lorem<T:Eq>(t:T) {
|
||||
let ipsum:Dolor = sit;
|
||||
}
|
6
tests/source/configs-space_before_bound-false.rs
Normal file
6
tests/source/configs-space_before_bound-false.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-space_before_bound: false
|
||||
// Space before bound
|
||||
|
||||
fn lorem<T:Eq>(t:T) {
|
||||
let ipsum:Dolor = sit;
|
||||
}
|
6
tests/source/configs-space_before_bound-true.rs
Normal file
6
tests/source/configs-space_before_bound-true.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-space_before_bound: true
|
||||
// Space before bound
|
||||
|
||||
fn lorem<T:Eq>(t:T) {
|
||||
let ipsum:Dolor = sit;
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
// rustfmt-space_before_type_annotation: false
|
||||
// Space before type-annotation
|
||||
|
||||
fn lorem<T:Eq>(t:T) {
|
||||
let ipsum:Dolor = sit;
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
// rustfmt-space_before_type_annotation: true
|
||||
// Space before type-annotation
|
||||
|
||||
fn lorem<T:Eq>(t:T) {
|
||||
let ipsum:Dolor = sit;
|
||||
}
|
6
tests/source/configs-spaces_around_ranges-false.rs
Normal file
6
tests/source/configs-spaces_around_ranges-false.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-spaces_around_ranges: false
|
||||
// Spaces around ranges
|
||||
|
||||
fn main() {
|
||||
let lorem = 0..10;
|
||||
}
|
6
tests/source/configs-spaces_around_ranges-true.rs
Normal file
6
tests/source/configs-spaces_around_ranges-true.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-spaces_around_ranges: true
|
||||
// Spaces around ranges
|
||||
|
||||
fn main() {
|
||||
let lorem = 0..10;
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
// rustfmt-spaces_within_angle_brackets: false
|
||||
// Spaces within angle-brackets
|
||||
|
||||
fn lorem<T: Eq>(t: T) {
|
||||
// body
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
// rustfmt-spaces_within_angle_brackets: true
|
||||
// Spaces within angle-brackets
|
||||
|
||||
fn lorem<T: Eq>(t: T) {
|
||||
// body
|
||||
}
|
6
tests/source/configs-spaces_within_parens-false.rs
Normal file
6
tests/source/configs-spaces_within_parens-false.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-spaces_within_parens: false
|
||||
// Spaces within parens
|
||||
|
||||
fn lorem<T: Eq>(t: T) {
|
||||
let lorem = (ipsum, dolor);
|
||||
}
|
6
tests/source/configs-spaces_within_parens-true.rs
Normal file
6
tests/source/configs-spaces_within_parens-true.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-spaces_within_parens: true
|
||||
// Spaces within parens
|
||||
|
||||
fn lorem<T: Eq>(t: T) {
|
||||
let lorem = (ipsum, dolor);
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
// rustfmt-spaces_within_square_brackets: false
|
||||
// Spaces within square-brackets
|
||||
|
||||
fn main() {
|
||||
let lorem: [usize; 2] = [ipsum, dolor];
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
// rustfmt-spaces_within_square_brackets: true
|
||||
// Spaces within square-brackets
|
||||
|
||||
fn main() {
|
||||
let lorem: [usize; 2] = [ipsum, dolor];
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
// rustfmt-struct_lit_multiline_style: ForceMulti
|
||||
// Struct literal multiline-style
|
||||
|
||||
fn main() {
|
||||
let lorem = Lorem { ipsum: dolor, sit: amet };
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
// rustfmt-struct_lit_multiline_style: PreferSingle
|
||||
// rustfmt-struct_lit_width: 100
|
||||
// Struct literal multiline-style
|
||||
|
||||
fn main() {
|
||||
let lorem = Lorem { ipsum: dolor, sit: amet };
|
||||
}
|
6
tests/source/configs-struct_lit_style-block.rs
Normal file
6
tests/source/configs-struct_lit_style-block.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-struct_lit_style: Block
|
||||
// Struct literal-style
|
||||
|
||||
fn main() {
|
||||
let lorem = Lorem { ipsum: dolor, sit: amet };
|
||||
}
|
6
tests/source/configs-struct_lit_style-visual.rs
Normal file
6
tests/source/configs-struct_lit_style-visual.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-struct_lit_style: Visual
|
||||
// Struct literal-style
|
||||
|
||||
fn main() {
|
||||
let lorem = Lorem { ipsum: dolor, sit: amet };
|
||||
}
|
6
tests/source/configs-struct_lit_width-above.rs
Normal file
6
tests/source/configs-struct_lit_width-above.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-struct_lit_width: 10
|
||||
// Struct literal-style
|
||||
|
||||
fn main() {
|
||||
let lorem = Lorem { ipsum: dolor, sit: amet };
|
||||
}
|
6
tests/source/configs-struct_lit_width-below.rs
Normal file
6
tests/source/configs-struct_lit_width-below.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-struct_lit_width: 100
|
||||
// Struct literal-style
|
||||
|
||||
fn main() {
|
||||
let lorem = Lorem { ipsum: dolor, sit: amet };
|
||||
}
|
8
tests/source/configs-struct_variant_width-above.rs
Normal file
8
tests/source/configs-struct_variant_width-above.rs
Normal file
@ -0,0 +1,8 @@
|
||||
// rustfmt-struct_variant_width: 10
|
||||
// Struct variant width
|
||||
|
||||
enum Lorem {
|
||||
Ipsum,
|
||||
Dolor(bool),
|
||||
Sit { amet: Consectetur, adipiscing: Elit, },
|
||||
}
|
8
tests/source/configs-struct_variant_width-below.rs
Normal file
8
tests/source/configs-struct_variant_width-below.rs
Normal file
@ -0,0 +1,8 @@
|
||||
// rustfmt-struct_variant_width: 100
|
||||
// Struct variant width
|
||||
|
||||
enum Lorem {
|
||||
Ipsum,
|
||||
Dolor(bool),
|
||||
Sit { amet: Consectetur, adipiscing: Elit },
|
||||
}
|
11
tests/source/configs-tab_spaces-2.rs
Normal file
11
tests/source/configs-tab_spaces-2.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// rustfmt-tab_spaces: 2
|
||||
// rustfmt-max_width: 30
|
||||
// rustfmt-array_layout: Block
|
||||
// Tab spaces
|
||||
|
||||
fn lorem() {
|
||||
let ipsum = dolor();
|
||||
let sit = vec![
|
||||
"amet", "consectetur", "adipiscing", "elit."
|
||||
];
|
||||
}
|
11
tests/source/configs-tab_spaces-4.rs
Normal file
11
tests/source/configs-tab_spaces-4.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// rustfmt-tab_spaces: 4
|
||||
// rustfmt-max_width: 30
|
||||
// rustfmt-array_layout: Block
|
||||
// Tab spaces
|
||||
|
||||
fn lorem() {
|
||||
let ipsum = dolor();
|
||||
let sit = vec![
|
||||
"amet", "consectetur", "adipiscing", "elit."
|
||||
];
|
||||
}
|
7
tests/source/configs-trailing_comma-always.rs
Normal file
7
tests/source/configs-trailing_comma-always.rs
Normal file
@ -0,0 +1,7 @@
|
||||
// rustfmt-trailing_comma: Always
|
||||
// Trailing comma
|
||||
|
||||
fn main() {
|
||||
let Lorem { ipsum, dolor, sit, } = amet;
|
||||
let Lorem { ipsum, dolor, sit, amet, consectetur, adipiscing } = elit;
|
||||
}
|
7
tests/source/configs-trailing_comma-never.rs
Normal file
7
tests/source/configs-trailing_comma-never.rs
Normal file
@ -0,0 +1,7 @@
|
||||
// rustfmt-trailing_comma: Never
|
||||
// Trailing comma
|
||||
|
||||
fn main() {
|
||||
let Lorem { ipsum, dolor, sit, } = amet;
|
||||
let Lorem { ipsum, dolor, sit, amet, consectetur, adipiscing } = elit;
|
||||
}
|
7
tests/source/configs-trailing_comma-vertical.rs
Normal file
7
tests/source/configs-trailing_comma-vertical.rs
Normal file
@ -0,0 +1,7 @@
|
||||
// rustfmt-trailing_comma: Vertical
|
||||
// Trailing comma
|
||||
|
||||
fn main() {
|
||||
let Lorem { ipsum, dolor, sit, } = amet;
|
||||
let Lorem { ipsum, dolor, sit, amet, consectetur, adipiscing } = elit;
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
// rustfmt-type_punctuation_density: Compressed
|
||||
// Type punctuation density
|
||||
|
||||
// FIXME: remove whitespace around `+`:
|
||||
fn lorem<Ipsum:Dolor+Sit=Amet>() {
|
||||
// body
|
||||
}
|
6
tests/source/configs-type_punctuation_density-wide.rs
Normal file
6
tests/source/configs-type_punctuation_density-wide.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// rustfmt-type_punctuation_density: Wide
|
||||
// Type punctuation density
|
||||
|
||||
fn lorem<Ipsum:Dolor+Sit=Amet>() {
|
||||
// body
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user