Nick Cameron
5fb1140688
fallout - source reformatting
2017-03-28 11:14:47 +13:00
Nick Cameron
e4efa22983
Source formatting fallout
2017-03-28 10:58:41 +13:00
Aaron Lobb
0dd0cc1941
Break use
statements into multiple lines ( #1407 )
...
This fixes how line lengths for use statements with multiple
items don't extend beyond the maximum line length.
Fixes #1400
2017-03-26 18:21:43 +13:00
Nick Cameron
488c0b9546
Test and source fallout
2017-03-22 09:25:26 +13:00
Nick Cameron
e7489356c6
Format glob imports
...
Fixes #1356
2017-03-08 10:12:42 +13:00
Nick Cameron
33b83ae7df
Formatting fallout
...
Also fixes a minor bug when we break a line after `if` and used to leave a trailing space
2017-03-07 09:50:41 +13:00
Nick Cameron
a7612cc773
more fallout
2017-02-23 13:15:48 +13:00
Nick Cameron
9eb78a3333
Fallout
2017-02-23 13:15:48 +13:00
Nick Cameron
428339fdc3
Refactor indent and width into Shape struct
2017-01-31 08:35:23 +13:00
Nick Cameron
6572874965
Update to latest Syntex
...
As a side-effect of the Path changes, we are now a bit more aggressive about normalising paths.
2017-01-20 08:20:49 +13:00
Nick Cameron
21c085261b
Remove self
from use foo::bar::self;
...
Also adds the `normalize_imports` config option.
Fixes #1252
2017-01-06 17:02:56 +13:00
Erick Tryzelaar
e67ffcfb21
Update to the latest syntex module
...
One notable feature is this this adds support for the experimental
`let x = loop { ... break $expr; }` syntax. This also includes a
test for formatting all the break and continue variations.
2016-12-23 11:20:07 -08:00
Fraser Hutchison
f933d31115
Fixes #1184 where reordering import items could cause a panic.
...
Also extends an existing test to avoid regression.
2016-11-03 04:21:47 +00:00
Nick Cameron
4418fab4f2
Update to latest Syntex
...
+ Cargo update
+ 0.6.2 release
2016-09-16 15:28:02 +12:00
sinkuu
a3c63fdef9
Run clippy
2016-08-29 08:57:27 +09:00
Stuart Dootson
61042e6e4d
Fix issue 1124 - detect start of output rather than start of input file when writing output source file ( #1133 )
...
* Change required to prevent a trailing space at the end of a separate module being propagated
* Detect the start of the output file rather than the start of the input file when deciding whether to output preceding snippets - this stops unnecessary whitespace and blank lines from being inserted when spans and statements are output in an order other than that from the input file.
* Add code to prevent space from being added with the prefix snippet if a) the snippet is entirely horizontal whitespace, or b) the snippet contains whitespace followed by a newline. This prevents trailing spaces at the end of a line from being added.
* Tests for this issue
* Tidy up `match` statements
* Add test with blank lines between `use` statements
2016-08-25 08:32:04 +12:00
Stuart Dootson
4029b0e704
Fix #1120 - rework how the use list prefix is determined. ( #1121 )
...
* Fix #1120 - rework how the use list prefix is determined.
* Added test commentary & another test case
2016-08-10 18:13:27 +12:00
Sergey Pepyakin
f6959a4772
Fix issue-1116
2016-08-04 08:54:40 +03:00
Julien Blanchard
b4e49ddbf5
Fix imports with absolute paths
2016-08-01 10:10:04 +02:00
Stuart Dootson
78b52ec3e1
Add use
declaration re-ordering ( #1104 )
...
* Add config options for combinations of lines and items
* Reordering of import lines implemented.
* Changed nested matches to tuple pattern matching
* Added ordering of path list items to the ordering of use declarations
* Move `format_imports` and `format_import` methods to `imports.rs`
* Add comment to explain how `use` declarations are split off while walking through a module
* Change `ImportReordering` config option to separate boolean options
2016-07-26 17:20:01 +12:00
Kamal Marhubi
bd10af127e
utils: Move codemap related utilities to a dedicated module
...
This commit adds a `codemap` module, and moves the `CodemapSpanUtils`
added in #857 to it. This is preparation for adding more `Codemap`
specific utilities.
Refs #434
2016-05-31 00:49:26 +02:00
Marcus Klaas
98c0570a28
Format non-statement if-else expressions on a single line
2016-05-29 17:58:38 +02:00
Nick Cameron
da65090050
Merge pull request #857 from kamalmarhubi/codemap-ext
...
utils: Add CodeMapExt extension trait for span_* methods
2016-03-14 18:00:51 +13:00
Kamal Marhubi
d82d9fc808
utils: Add CodeMapSpanUtils trait for span_* methods
...
This commit adds a CodeMapSpanUtils extension trait on CodeMap, and
moves some functions to methods there:
- span_after
- span_after_last
- span_before
This better reflects them being lookup methods on the codemap.
2016-03-13 18:14:07 -04:00
Kamal Marhubi
589dabda2f
deps: Update syntex_syntax to 0.29.1
2016-03-02 13:08:21 -05:00
Nick Cameron
d86cfb357a
Format all patterns (well, except macros)
...
Fixes #18
Fixes #672
2016-02-12 14:59:13 +13:00
Marcus Klaas
6e1f77664d
Unwrap match arms that are simple blocks
2015-11-20 21:05:18 +01:00
Eli Friedman
2fff041b43
Pass in whether an ast::Path is in an expression context.
...
This gets rid of a slightly nasty hack involving scanning the source
expression for a ":".
2015-11-14 13:54:57 -08: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
431e8d9d2f
Remove a few unchecked subtractions, uses of ty_to_string
2015-09-27 17:56:38 +02:00
Nick Cameron
b2e7da0aa0
Format imports with aliases.
...
Closes #366
2015-09-26 18:12:25 +12:00
Pavel Sountsov
d4108a3029
Initial implementation of hard tab indentation.
2015-09-19 10:36:45 -07:00
Marcus Klaas
7f576b0602
General cleanup after rebase
2015-09-11 00:53:21 +02:00
Marcus Klaas
659c9b9037
Update indentation heuristics for single arg functions
2015-09-11 00:52:20 +02:00
Marcus Klaas
d05a41c773
Add failure mode to write_list
2015-09-07 20:35:25 +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
54a96355dd
Phase out token::get_ident in favour of ToString
...
token::get_ident was removed in rust commit 00a5e66f818ad9d79cc4425f5564c7b07e3213a6
2015-07-31 13:10:19 +02:00
Marcus Klaas
397d0d3d72
Format simple imports
2015-07-25 23:17:56 +02:00
cassiersg
5168d7458a
Indent fix
2015-07-25 19:00:38 +02:00
Gaëtan Cassiers
30b16bc474
Move 'use' to Rewrite
...
Implements Rewrite for ViewPath
Behavior change: always use max_width instead of ideal_width for use
list rewrite. I think it looks better, was also suggested by @nrc in
https://github.com/nrc/rustfmt/issues/82#issuecomment-105314265
2015-07-25 19:00:38 +02:00
Marcus Klaas
c4101de53d
Refactor some things; add extra tests.
2015-07-24 19:00:14 +02:00
Marcus Klaas
b161815fe0
Format if-else expressions
2015-07-19 23:42:54 +02:00
Nick Cameron
979d0c9756
Resolve some warnings
2015-07-17 18:26:10 +12:00
Nick Cameron
018fa85453
Reformat code to new struct lit style
2015-07-16 14:05:10 +12:00