Marcus Klaas
b3488c6186
Fix constraints on pattern formatting of else arms
2016-06-03 23:18:19 +02:00
Srinivas Reddy Thatiparthy
952a6beb51
change normalise spelling to American version - normalize as American english is more common across programming community
2016-05-15 22:24:46 +05:30
Nick Cameron
c696dcf8da
Handle attributes on modules ( #968 )
...
* Handle attributes (including doc comments) on inline modules
Closes #22
Closes #684
* Tweak the rules for changing indentation in comments (to do it less often).
2016-05-02 10:54:25 +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
Nick Cameron
7ac354fd09
Don't be so aggressie about line-breaking strings ( #911 )
...
We will no longer break in the middle of words, only at whitespace or punctuation.
This means we sometimes over-run, but that seems better than some of the bad splits we see.
Closes #369
2016-04-11 20:45:47 +02:00
Nick Cameron
9d8ce54428
Don't apply the function args heuristic to tuple lits.
...
Closes #450
Closes #510
2016-03-14 20:51:06 +13:00
Gaëtan Cassiers
b117d7b2b8
Document comment::*CodeCharKind
2016-01-10 22:04:30 +01:00
Gaëtan Cassiers
9f98f725cb
Detect when comments disappear
...
When the reformatted code doesn't contain the same quantity of comments
as the original code, use the original code instead of the reformatted
code.
This is done for all expressions and `let` statements.
This should be used at the finest grained level possible, to avoid that
a small disappearing comment prevents a big chunk of code to be
reformatted.
Kind of fixes (avoid disappearing comments, but prevents a good
formatting is such case) #285 #225 #563 #743
2016-01-10 15:20:58 +01:00
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
b577f95e3c
Reformatting due to changes
2015-11-23 13:09:00 +13:00
Marcus Klaas
8f3a29d1a7
Blockify multiline match arms
2015-11-20 21:05:10 +01:00
Nick Cameron
b7d61254a7
Option to disable line breaking in comments
...
Set to false by default for now, since we are having a lot of problems with comments. We should set to true once we have a better algorithm.
2015-11-10 08:03:01 +13:00
Alex Crichton
36abfe5dc2
Remove usage of many unstable features
...
This removes usage of:
* PathExt
* split_last
* split_last_mut
* catch_panic
The catch_panic one was a little tricky as the ident interner needed to be
cloned across threads (a little unsafely), but it should otherwise be good to
go.
2015-10-23 13:46:14 -07:00
Tim Kuehn
6b4ef7457a
Fix doc comment regression and add tests.
2015-10-20 02:13:14 -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
cf0f5ca814
Implement CommentCodeSlices
2015-10-19 23:06:35 +02:00
Marcus Klaas
199d40fa55
Increase default function call width limit
2015-10-06 22:27:11 +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
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
7f576b0602
General cleanup after rebase
2015-09-11 00:53:21 +02:00
Marcus Klaas
8e471ece31
Add some tests for match blocks
2015-09-11 00:53:01 +02:00
Marcus Klaas
abe8e7de99
Add tests for chain expressions
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
Sinh Pham
94a26f3c9c
Fix https://github.com/nrc/rustfmt/issues/278
2015-09-07 00:30:46 -04:00
Andre Bogus
d6c652e33c
code improvements suggested by clippy
2015-09-04 23:39:33 +02:00
Marcus Klaas
1ae2d417b8
Remove faulty shortcut in rewrite_string_lit
...
Rustfmt would leave the literal unchanged when it did not exceed the column limit in its original position, not considering its position after formatting.
2015-09-01 20:42:07 +02:00
Nick Cameron
4b3262f514
Add a test module to comments
2015-09-01 15:39:37 +12:00
Gaëtan Cassiers
e5ea13da6e
Add a generic tool for searching comments in code
...
This make a base for all functions searching for comments, or searching
code excluding comments, etc. These functions where too simple and
didn't handle complicated cases like nested comments or comment marks
inside string litterals ("/*").
2015-08-28 14:32:02 +02:00
Marcus Klaas
120fd2426e
Format assignment
2015-08-25 21:43:13 +02:00
Nick Cameron
a43e2b5ae8
Formatting
2015-08-20 08:11:14 +12:00
Nick Cameron
8461e8a0a8
Merge pull request #147 from marcusklaas/even-more-expr
...
Format if expressions & loops
2015-07-25 09:51:59 +12:00
Marcus Klaas
3aa03dcc25
Use new module code from libsyntax
2015-07-24 19:25:01 +02:00
Marcus Klaas
b161815fe0
Format if-else expressions
2015-07-19 23:42:54 +02:00
Nick Cameron
018fa85453
Reformat code to new struct lit style
2015-07-16 14:05:10 +12: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
Marcus Klaas
0ef5db9496
Format tuple-like structs
2015-06-23 16:54:42 +02:00