Commit Graph

102 Commits

Author SHA1 Message Date
Nick Cameron
f8cb1baadd Add normalise_comments option.
So block comments are not converted to line comments
2015-12-10 09:29:03 +13:00
Nick Cameron
e94bd34a06 cargo upgrade, bug fix, and prepare for packaging 2015-12-08 16:19:23 +13:00
Nick Cameron
db72e0390c Merge pull request #664 from marcusklaas/fix-reformat-failurez
Don't include failed item rewrites in missed spans
2015-12-07 08:33:02 +13:00
Ms2ger
1ed36a3a6b Use starts_with to avoid panics. 2015-12-04 16:10:14 +01:00
Marcus Klaas
0fb9611786 Don't include failed item rewrites in missed spans 2015-11-30 23:12:50 +01:00
Markus Westerlind
c61d6d4c3a Format type aliases
Fixes #486
2015-11-26 21:04:49 +01:00
Seo Sanghyeon
2b11d84119 Apply Clippy 2015-11-25 15:39:15 +09:00
Marcus Klaas de Vries
5a3f5bc1f6 Merge pull request #646 from rust-lang-nursery/mulit-file
Handle multiply-referenced files
2015-11-23 21:35:09 +01:00
Jakko Sikkar
411fa40988 update dependencies and fix compile errors 2015-11-23 20:54:33 +02:00
Nick Cameron
2661592d59 Handle multiply-referenced files
Fixes #645
2015-11-23 15:22:00 +13:00
Nick Cameron
9cf8529e33 Implement formatting for impls
Fixes #614
2015-11-23 13:09:00 +13:00
Nick Cameron
ba936766c6 Take rustfmt_skip attribute into account on modules
Closes #632
2015-11-23 09:20:53 +13:00
Marcus Klaas
1b0ae00488 Extract fn rewrite methods from RewriteVisitor 2015-11-22 13:45:51 +01:00
Marcus Klaas
49e2a146b1 Rewrite module declarations 2015-11-21 21:06:29 +01:00
Kevin Yeh
2e9b6dfab4 Combine rewrite_single_line_fn and rewrite_fn 2015-11-19 20:49:24 -06:00
Kevin Yeh
15ec5b2912 Fix empty body format, add fn_empty_single_line option, refactor block tests 2015-11-19 20:45:02 -06:00
Kevin Yeh
fbd1398c92 Implement Rewrite for ast::Stmt 2015-11-19 14:23:56 -06:00
Kevin Yeh
4d7de5a16e Support single-line functions
By default, places functions with empty bodies on one line.
If the function has only one expression or statement that fits on one line, the 'fn_single_line' option can be used.
2015-11-19 14:23:56 -06:00
Nick Cameron
56a765ef05 Rustup 2015-11-16 14:16:46 +13:00
Nick Cameron
3dc0b804f1 Don't strip semi-colons from expressions with non-void type since it can change semantics 2015-11-09 13:23:19 +13:00
Eli Friedman
1c235de97d Fix crash speculatively parsing macro arguments as expressions.
The problem is essentially that if we try to parse a token tree using a
CodeMap different from the one the tree was originally parsed with,
spans become nonsense. Since CodeMaps can't be cloned, we're basically
forced to use the original ParseSess for additional parsing.

Ideally, rustfmt would be a bit more clever and figure out how to parse
macro arguments based on the definition of the macro itself, rather than
just guessing that a particular token sequence looks like an expression,
but this is good enough for now.

Fixes #538.
2015-10-27 23:41:32 -07:00
Marcus Klaas
d122ad5adc Address some issues with multiline patterns in let statements 2015-10-24 13:13:15 +02:00
Ravi Shankar
d135217db2 show rustfmt coverage! 2015-10-24 15:22:37 +05:30
Eli Friedman
be9e7dc689 Don't use visit::walk_*. Instead, recurse by hand.
This is much more straightforward to understand given how rustfmt
rewriting works, and it avoids walking into expressions in unexpected
places.

Fixes #513. Fixes #514.
2015-10-21 13:46:13 -07:00
Marcus Klaas
e8447a8210 Fix large block comments 2015-10-19 23:06:36 +02:00
Marcus Klaas
3970748f59 Remove overflow indentation 2015-10-19 23:06:36 +02:00
Marcus Klaas
11756d2ef8 Refactor enum formatting 2015-10-19 21:28:05 +02:00
Marcus Klaas
7e0456b852 Format visibility for statics and consts 2015-10-19 20:08:03 +02:00
Marcus Klaas
3ce425c9ed Factor out common item indentation idiom 2015-10-18 22:59:39 +02:00
Marcus Klaas
1a7d39041e Format constants and static variables 2015-10-18 21:36:26 +02:00
Marcus Klaas
b039e3a8c3 Force semicolons after break/continue/return. Remove after blocks. 2015-10-15 19:55:42 +02:00
Nick Cameron
6600cd341a Format inner and outer attributes separately.
Actually just skips inner attributes, because its a pain to track them, and lets missed spans handle them.

Closes #413
2015-10-08 17:20:19 +13: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
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
99d71a164a Changes to source formatting 2015-09-26 13:58:12 +12:00
Marcus Klaas
a7690cb1e5 Make rewrite_string return Option<String> 2015-09-25 13:01:20 +02:00
Marcus Klaas
71faa8984d Format foreign functions and statics 2015-09-21 20:02:45 +02:00
Marcus Klaas
f8e74bfa2c Place the closing brace of an inline mod on a new line 2015-09-20 14:22:12 +02:00
Pavel Sountsov
01bdcd0014 Remove unnecessary config parameter from format_missing_with_indent. 2015-09-19 10:44:28 -07:00
Pavel Sountsov
620650219e Use the block_indent inside visit_expr.
This seems to pass all the tests and greatly improves the formatting output
when using hard tabs.
2015-09-19 10:36:46 -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
e72d488281 Refactor test code
No longer use callbacks or thread::catch_panic; reduce stdout spew; guard against rustfmt breaking the column limit.
2015-09-18 22:34:46 +02:00
Marcus Klaas
f751356910 Format macro invocations 2015-09-16 20:26:14 +02:00
Marcus Klaas
a9814149c9 Align dots in chained expressions 2015-09-11 00:53:01 +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
d05a41c773 Add failure mode to write_list 2015-09-07 20:35:25 +02:00