diff options
| author | Marcus Klaas de Vries <mail@marcusklaas.nl> | 2015-09-20 12:27:16 +0200 |
|---|---|---|
| committer | Marcus Klaas de Vries <mail@marcusklaas.nl> | 2015-09-20 12:27:16 +0200 |
| commit | ce2c4f6be61305c8bb487e0f7cae760f5918fe07 (patch) | |
| tree | aa22ad53618ae4d5630a14734a32b527c1e7899d /tests/source | |
| parent | 4e1fff8710d9ad67cdfac08dbd6ffcb0c6fc4bc4 (diff) | |
| parent | 01bdcd001443d7639fc0127e31c61e5ff4e98464 (diff) | |
Merge pull request #290 from SiegeLord/tabs
Initial implementation of hard tab indentation.
Diffstat (limited to 'tests/source')
| -rw-r--r-- | tests/source/hard-tabs.rs | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/tests/source/hard-tabs.rs b/tests/source/hard-tabs.rs new file mode 100644 index 00000000000..3fe38a5e42a --- /dev/null +++ b/tests/source/hard-tabs.rs @@ -0,0 +1,69 @@ +// rustfmt-hard_tabs: true + +fn main() { +let x = Bar; + +let y = Foo {a: x }; + +Foo { a: foo() /* comment*/, /* comment*/ b: bar(), ..something }; + +fn foo(a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32) {} + +let str = "AAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAa"; + +if let (some_very_large, tuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuple) = 1 ++ 2 + 3 { +} + + if cond() { + something(); + } else if different_cond() { + something_else(); + } else { + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + } + +unsafe /* very looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong comment */ {} + +unsafe // So this is a very long comment. + // Multi-line, too. + // Will it still format correctly? +{ +} + +let z = [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz, q]; + +fn generic<T>(arg: T) -> &SomeType + where T: Fn(// First arg + A, + // Second argument + B, C, D, /* pre comment */ E /* last comment */) -> &SomeType { + arg(a, b, c, d, e) +} + + loong_func().quux(move || { + if true { + 1 + } else { + 2 + } + }); + + fffffffffffffffffffffffffffffffffff(a, + { + SCRIPT_TASK_ROOT + .with(|root| { + *root.borrow_mut() = Some(&script_task); + }); + }); + a.b + .c + .d(); + + x().y(|| { + match cond() { + true => (), + false => (), + } + }); +} |
