Commit graph

1441 commits

Author SHA1 Message Date
Sebastian Blunt
235f33b230
Make tests fail if rustfmt encounters an error
Previously tests would not fail if they encountered an error such as
LineOverflow or TrailingWhitespace. Making the tests error out will fix
this mismatch between running rustfmt for real and running the tests.

This also modifies all tests that previously contained errors so that
they no longer contain errors (in almost all of the tests this is
accomplished by setting error_on_line_overflow = false).
2017-02-19 19:57:02 +01:00
Sebastian Blunt
f6ccbd71c3
Add error_on_line_overflow option
Makes it configurable whether to error if unable to get all lines within
the max_width.
2017-02-19 19:56:37 +01:00
Casey Rodarmor
4f939ddf0c Don't print config file by default (#1313)
Supress `Using rusftmt config file...` messages unless the --verbose
flag is given.
2017-02-13 12:50:10 +13:00
sinkuu
fad74c8ac9 Support field-init-shorthand (#1308) 2017-02-13 07:16:11 +13:00
Craig M. Brandenburg
f2c867d067 New disable_all_formatting config option (#1297)
* New `disable_all_formatting` config option

* Resolve code review comments
2017-02-07 17:11:47 +13:00
Nick Cameron
5925a1a6d1 Merge pull request #1295 from tspiteri/let-if-else
Handle multiline condition in let if else (fixes #1239)
2017-02-01 13:14:59 +13:00
Trevor Spiteri
6810c762df Handle multiline condition in let if else (fixes #1239) 2017-01-31 23:35:57 +01:00
Nick Cameron
428339fdc3 Refactor indent and width into Shape struct 2017-01-31 08:35:23 +13:00
Nick Cameron
6054f28bd2 Some debugging stuff 2017-01-27 09:14:26 +13:00
Nick Cameron
e56ef44a3a Do not format string lits by default 2017-01-27 08:11:59 +13:00
Nick Cameron
1f3100d7bb Make string lit formatting fallible
This allows expressions containing string lits to wrap their content

Fixes #1282
2017-01-27 08:04:52 +13:00
Nick Cameron
309fb37f23 Allow some unused fields 2017-01-27 07:42:34 +13:00
Nick Cameron
6747cd721c Start factoring out an abstract Item 2017-01-27 07:37:09 +13:00
Nick Cameron
3d3b6784d1 Nits 2017-01-26 15:44:54 +13:00
Nick Cameron
2261947f6e Catch attributes before comments
Closes #1280
Closes #1284
2017-01-26 15:10:47 +13:00
Nick Cameron
b5d4421a83 Merge pull request #1286 from IvanUkhov/custom-build
Process build scripts
2017-01-26 08:15:47 +13:00
Ivan Ukhov
56e0c463d5 Process build scripts 2017-01-25 08:29:48 +01:00
Nick Cameron
72a67f4523 Merge pull request #1281 from shepmaster/patch-1
Add categories to Cargo.toml
2017-01-21 09:05:04 +13:00
Jake Goulding
d947646d6f Add categories to Cargo.toml 2017-01-20 12:44:44 -05:00
Nick Cameron
907134c2d1 v0.7.1 2017-01-20 08:21:46 +13:00
Nick Cameron
e018712612 process cfg'ed off modules
Fixes #1229
Fixes #1277
2017-01-20 08:20:49 +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
49e86a1e65 Handle semicolons in macro statements
Fixes #1279
2017-01-18 10:38:46 +13:00
Nick Cameron
923423fa32 v0.7.0 and cargo update 2017-01-17 13:12:08 +13:00
Nick Cameron
0b1d78bae1 Try hard to format impl signatures
Fixes #1249
2017-01-17 13:08:36 +13:00
Nick Cameron
29e8913695 Fix bug in identifying comments
Fixes 1233
2017-01-17 12:01:10 +13:00
Nick Cameron
0218a41d73 Add a more lightweight method for rewriting comments when we are not normalising
Fixes #652
2017-01-17 10:17:48 +13:00
Nick Cameron
d948485371 Allow empty blocks on one line in more places
In particular if they contain only a single-line comment.

Fixes #493
2017-01-16 16:37:58 +13:00
Nick Cameron
846d7ad387 make rustfmt-normalize_comments false by default 2017-01-16 14:50:27 +13:00
Nick Cameron
5349336192 Refactor if/else formatting
Removes else_if_brace_style from config options. Use control_brace_style instead.
2017-01-11 18:14:41 +13:00
Nick Cameron
9be2971274 Refactor pairs/binops 2017-01-11 12:06:23 +13:00
sinkuu
7e2fcc27e1 Fix #1258 (#1266)
* Fix #1258

* Add test
2017-01-09 16:11:12 +13:00
Stepan Koltsov
ad46f9af95 Do not ignore space_before_bound in where clause (#1267) 2017-01-09 15:58:06 +13:00
Stepan Koltsov
1c22d85db5 Better message for LineOverflow error (#1268)
(with current length and configured limit)
2017-01-09 15:57:11 +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
Nick Cameron
6ecf5b8e84 If a string goes over-width, give up formatting it
Logic here is that the original might be better and at best we'll only make it a different kind of bad.

Fixes #1237
2017-01-06 16:35:28 +13:00
Nick Cameron
32cb839855 Macros in types are possible
Fixes #1234
2017-01-06 16:06:09 +13:00
sinkuu
1358f1ac80 Fix #1259 (#1263)
* Use `Indent::block_indent` instead of adding `config.tab_spaces`

* Fix #1259 impl block closing brace placement
2017-01-04 09:20:02 +13:00
Nick Cameron
90db34a961 Merge pull request #1251 from erickt/master
Version bump for dependencies, add support for `break` values
2016-12-24 10:48:46 +13:00
Erick Tryzelaar
836682eef4 Version bump for toml, unicode-segmentation, itertools, and walkdir 2016-12-23 11:26:23 -08: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
Antoine Gersant
2f6c93b4f7 Fixed broken link to style guidelines (#1245) 2016-12-21 19:32:04 +13:00
Jason Dusek
22ddc36b17 Recognize "rlib" and "cdylib" crates (#1238)
Addresses #828 and https://github.com/lunaryorn/emacs-module.rs/issues/4 and probably numerous others.
2016-12-16 08:56:15 -10:00
Luke Clifton
56469a8745 Don't drop opening brace on long line matches. (#1228)
* Don't drop opening brace on long line matches.

Fixes #1225

* Added a test case for long match arms with braces on newline.
2016-11-28 13:47:38 +13:00
Luke Clifton
6bf1382927 Indent open brace for impl when nested. (#1227)
* Indent open brace for impl when nested.

Fixes #1226

* Added test case for indented impl with brace on newline
2016-11-28 13:47:07 +13:00
Nick Cameron
1cc4f0c35f Merge pull request #1231 from mineo/condense_wildcard_suffices
Prevent an ugly linebreak in --config-helps description of condense_wildcard_suffices
2016-11-28 09:52:27 +13:00
Wieland Hoffmann
2fc1a2d3cc Prevent an ugly linebreak in --config-helps description of condense_wildcard_suffices 2016-11-27 21:43:02 +01:00
Nick Cameron
d3eba76e4d update Serde, etc.
Lots of changes to how closures work
2016-11-21 11:02:18 +13:00
Nick Cameron
61ab06a92e v0.6.3 2016-11-20 10:37:34 +13:00
Bekh-Ivanov Aleksey
935286755c Stripping trailing commas and spaces from vec! elements (#1219)
* Stripping trailing commas and spaces from `vec!` elements

* Stripping trailing commas and spaces ONLY from `vec!` elements

* Added comment
2016-11-14 17:42:15 +13:00