Commit graph

65 commits

Author SHA1 Message Date
Nick Cameron
428339fdc3 Refactor indent and width into Shape struct 2017-01-31 08:35:23 +13:00
Martin Wohli
6c32c02952 fix #1216: panic on comment starting with //* 2016-11-13 09:36:43 +01:00
sinkuu
a3c63fdef9 Run clippy 2016-08-29 08:57:27 +09:00
Marcus Klaas
98c0570a28 Format non-statement if-else expressions on a single line 2016-05-29 17:58:38 +02:00
Marcus Klaas
eae2921e14 Bootstrap it. Hard. 2016-05-12 21:50:43 +02:00
Nick Cameron
a9c3108c9c Change defaults and update tests and source
New defaults are `Tabbed` for `chain_indent` and `chain_base_indent`, and `5` for `closure_block_indent_threshold`.
2016-04-22 19:18:48 +12:00
Manish Goregaokar
ffe9c9d834 Clippy rustfmt 2016-01-07 12:17:22 +05:30
Seo Sanghyeon
2b11d84119 Apply Clippy 2015-11-25 15:39:15 +09:00
Marcus Klaas
4b4dd170d8 Correct doc comment indentation for struct fields
Fix https://github.com/rust-lang-nursery/rustfmt/issues/572.
2015-11-22 22:55:57 +01:00
Marcus Klaas
6e1f77664d Unwrap match arms that are simple blocks 2015-11-20 21:05:18 +01:00
Florian Zeitz
2aa35f0f6d Honor "enum_trailing_comma" option. Fixes #556 2015-11-03 23:57:31 +01:00
Marcus Klaas
a9bd695723 Format vec! macro using brackets 2015-10-16 22:55:42 +02:00
Nick Cameron
aed558fce4 Handle multi-line return types and multi-line tuples
Closes #409
2015-10-10 14:55:31 +13:00
Sinh Pham
f075fd01ab Fix https://github.com/nrc/rustfmt/issues/430 2015-10-08 22:49:16 -07:00
mwiczer
5162282b60 Support pre- and post-comments for enums
Use lists to format enum variants rather than special formatting.
Add tests for enums mostly around block comments.
2015-10-08 17:22:57 -04:00
Marcus Klaas de Vries
5eeae3944e Merge pull request #404 from marcusklaas/rewrite-list-fmt
List formatting refactoring
2015-10-06 22:29:52 +02:00
Marcus Klaas
199d40fa55 Increase default function call width limit 2015-10-06 22:27:11 +02:00
Marcus Klaas
a76df6b4d9 Make listItem contain option 2015-10-04 20:40:14 +02:00
Marcus Klaas
965ea09664 Split ListTactic decision logic from write_list 2015-10-04 20:40:14 +02:00
Marcus Klaas
84718b5b90 Format rustfmt's own indices 2015-10-02 11:48:52 +02:00
Nick Cameron
617eed353c Changes to rustfmt source 2015-09-26 18:29:48 +12:00
Nick Cameron
b894dd8abf Use a width heuristic for struct lits.
Closes #123
2015-09-26 18:25:41 +12:00
Nick Cameron
d161b8df72 rebasing changes and address review comment 2015-09-26 14:00:19 +12:00
Nick Cameron
ebf64ca35d Heuristic max width for function calls 2015-09-26 13:54:22 +12:00
Nick Cameron
dcbfd0469f Merge pull request #362 from marcusklaas/rewrite-string
Make rewrite_string return `Option<String>`
2015-09-26 13:36:59 +12:00
Marcus Klaas
5db17ca703 Use the maximum available width in struct formatting
Previously, we'd use an approximation for the maximum width since the configuration wasn't available in `write_list`.
2015-09-25 16:56:22 +02:00
Marcus Klaas
a7690cb1e5 Make rewrite_string return Option<String> 2015-09-25 13:01:20 +02:00
Eli Friedman
19e887c309 Add support for formatting AddrOf (unary "&"). 2015-09-24 01:13:57 -07:00
Pavel Sountsov
03e1b27826 Add Indent::none(), remove make_indent. 2015-09-19 10:36:45 -07:00
Pavel Sountsov
d4108a3029 Initial implementation of hard tab indentation. 2015-09-19 10:36:45 -07:00
Marcus Klaas
f751356910 Format macro invocations 2015-09-16 20:26:14 +02:00
Marcus Klaas
03c660633f Refine chain breaking heuristics
Don't make a single line chain when it is was multi line in the source; allow overflow of the last chain element onto the next lines without breaking the chain.
2015-09-11 00:53:01 +02:00
Marcus Klaas
48d17f54d3 Rebase onto master 2015-09-11 00:53:01 +02:00
Marcus Klaas
749a9689be Break chains that don't start with path expressions 2015-09-11 00:52:57 +02:00
Marcus Klaas
659c9b9037 Update indentation heuristics for single arg functions 2015-09-11 00:52:20 +02:00
Marcus Klaas
c680bb4030 Implement basic chain formatting 2015-09-11 00:52:16 +02:00
Marcus Klaas
f80dcbbd84 Split off binary search 2015-09-07 22:21:56 +02:00
Marcus Klaas
d05a41c773 Add failure mode to write_list 2015-09-07 20:35:25 +02:00
Andre Bogus
d6c652e33c code improvements suggested by clippy 2015-09-04 23:39:33 +02:00
Nick Cameron
97e92b35cc Preserve some whitespace between struct fields etc. 2015-09-02 14:11:19 +12:00
Nick Cameron
02a01350ff Support where predicates on the same line 2015-09-01 18:53:16 +12:00
Marcus Klaas
120fd2426e Format assignment 2015-08-25 21:43:13 +02:00
Ivan Apachev
c7e6d0b54a Replace uses of x.len() == 0 by x.is_empty() #187 2015-08-25 01:07:48 +03:00
Marcus Klaas
5fcd313b08 Format closures 2015-08-19 23:15:56 +02:00
Nick Cameron
a43e2b5ae8 Formatting 2015-08-20 08:11:14 +12:00
Marcus Klaas
4e0a8da447 Refactor itemize list so that it produces an iterator 2015-08-19 18:40:02 +02:00
Marcus Klaas
41bca58100 Format paths 2015-08-16 22:53:06 +02:00
Marcus Klaas
2fa6220f57 Format all the loops! 2015-07-19 23:43:32 +02:00
Gaëtan Cassiers
990a123e1c Run rustfmt on the code 2015-07-03 11:13:28 +02:00
Marcus Klaas
482f200b0b Update import list formatting
Include comments and sort items alphabetically.
2015-06-26 03:43:12 +02:00