Commit Graph

298 Commits

Author SHA1 Message Date
Nick Cameron
4153e66e42 Move non-public API from lib.rs to its own module 2018-07-23 12:45:41 +12:00
Nick Cameron
b085113cbe Trigger an internal error if we skip formatting due to a lost comment 2018-07-20 16:05:19 +12:00
Nick Cameron
b27d544478 replace_with_system_newlines doesn't need to be public 2018-07-18 09:16:51 +12:00
Nick Cameron
d911b640d1
Merge pull request #2823 from fwalch/default-newline-style
Change default newline style to "Native"
2018-07-17 11:18:10 +12:00
Nick Cameron
b68fd9e6bf Move pair handling to its own module 2018-07-12 21:37:28 +12:00
Seiichi Uchida
60ce411b53 Format async closure 2018-07-09 23:20:53 +09:00
Florian Walch
363363d066 test: Assert CRLF line endings on Windows 2018-07-02 23:43:59 +02:00
Shohei Wada
036244cdce Fix #2728. 2018-06-19 20:51:49 +09:00
Seiichi Uchida
0ec1533054
Merge pull request #2779 from thibaultdelor/stableApi
Improve end lines handling
2018-06-11 11:38:26 +09:00
Tibo Delor
2e90c4314c
Stop delaying Trailing whitespace error reporting 2018-06-10 14:19:09 +10:00
Tibo Delor
42efae5944
Clean Up code where last whitspace tracking isn't used 2018-06-10 14:07:33 +10:00
Tibo Delor
6b00b8b302
Move newline logic inside the formatting process.
Why?:
 - Conceptually it sounds right
 - Absolutely all write modes where doing it anyway
 - It was done several times in some in case
 - It greatly simplify the code
2018-06-10 00:25:47 +10:00
Tibo Delor
8c32a9d909
Parse Error return an Error instead of a successful empty response 2018-06-10 00:25:06 +10:00
Seiichi Uchida
c95fa8cbe2 Return None when the formatting of macro failed in format_snippet 2018-06-07 12:33:33 +09:00
Seiichi Uchida
d1477ca1de Add a field in Summary for notiyfing about formatting failure of macro 2018-06-07 12:32:58 +09:00
Nick Cameron
173ae0d7b9 0.8.2 2018-05-28 11:47:21 +12:00
Nick Cameron
632fab4c95 documentation 2018-05-21 15:54:56 +12:00
Nick Cameron
6541be3c6f Replace use_colored_tty with iatty crate 2018-05-21 15:32:27 +12:00
Nick Cameron
9a7fac63c8 Remove format_and_emit_report from the API
Also changes the header/footer stuff
2018-05-21 15:09:17 +12:00
Nick Cameron
95d6b64829 Replace WriteMode with EmitMode and backup bool 2018-05-21 14:14:09 +12:00
Nick Cameron
843c12601a Use our own FileName struct rather than exporting libsyntax's 2018-05-21 12:08:39 +12:00
Nick Cameron
539d4d9665 Refactor CliOptions 2018-05-21 11:27:25 +12:00
Nick Cameron
abb253df8b Rationalise result and error types 2018-05-21 08:58:53 +12:00
Nick Cameron
432b1cb253 Rationalise error types
cc #2639
2018-05-21 08:58:53 +12:00
Nick Cameron
760af6cfc9 Make format_snippet and format_code_block private
cc #2639
2018-05-21 08:58:53 +12:00
Nick Cameron
1452349966 Exit with 1 for license check in --check mode
Closes #2707
2018-05-18 15:30:32 +12:00
Nick Cameron
390a284851 Give a deprecation warning on rustfmt_skip and an error on rustfmt:: other than skip 2018-05-14 18:10:46 +12:00
Nick Cameron
51f566062f Update uses of rustfmt_skip to rustfmt::skip 2018-05-14 16:25:10 +12:00
Nick Cameron
6d0695303a Make some write modes unstable 2018-05-14 10:55:16 +12:00
Nick Cameron
5d9f5aa05a Replace --write-mode with --emit
cc #1976
2018-05-13 14:13:24 +12:00
Nick Cameron
8396da1882 Add --backup flag 2018-05-13 13:18:08 +12:00
Nick Cameron
4d9de48e06 Add --check flag.
cc #1976
2018-05-11 20:26:00 +12:00
Nick Cameron
55ac062da0 Add --quiet flag, remove Plain write mode
cc #1976
2018-05-11 13:50:30 +12:00
Nick Cameron
5dba81bbbf
Merge pull request #2687 from Marwes/issue_2641
fix: Don't insert an extra brace in macros with native newlines
2018-05-09 13:18:27 +12:00
Markus Westerlind
4c9ef93df7 fix: Don't insert an extra brace in macros with native newlines
Due to `format_snippet` formatting the input with \r\n the subtraction
would wouldn't give a length that removed the }

Fixes #2641
2018-05-08 20:34:44 +02:00
topecongiro
bd25c7d0f7 Cargo fmt 2018-05-08 06:25:48 +09:00
Nick Cameron
4bbd5c4ae5
Merge pull request #2681 from topecongiro/issue-2680
Error on self_tests when there are lines that exceed max width
2018-05-07 11:20:33 +12:00
topecongiro
51c07f4335 Fix up lines exceeding max width 2018-05-06 16:17:09 +09:00
topecongiro
1f738ea208 Cargo fmt 2018-05-06 15:22:29 +09:00
Nick Cameron
d8982e5efe Suppress warning about unused attribute 2018-05-02 10:18:14 +12:00
Ryan Leung
fb9a5add9b add rustc_target to dependencies (#2660) 2018-04-28 16:08:58 +09:00
Tibo
b7df23c3d5
Replace completely std::error with failure crate 2018-04-26 13:48:48 +10:00
Tibo
5581be2616
Use failure for FormattingError 2018-04-26 12:18:30 +10:00
Seiichi Uchida
ac8ae00625
Cargo update and clippy (#2643) 2018-04-25 07:21:23 +09:00
Nick Cameron
866900449a Make some more stuff private
0.6
2018-04-20 22:10:48 +12:00
Nick Cameron
ca610d35b3 Refactor to make a sensible public API
0.5 - lots of breaking changes

cc #2639
2018-04-20 21:52:02 +12:00
David Barsky
f9532ba8d7 Implemented rough draft of check write mode. (#2539)
* Add rough draft of `check` mode. Not unit tested.

* Added assert-cli; simple test case for `--write-mode=check`

* Lightly documented `check` WriteMode

* wrote clearer phrasing for config::options::WriteMode::Check

* Implemented default for WriteMode where default is Overwrite

* Simplified exit code handling

* updated README.md as per @nrc' comment

* collapsed exit-code handling

* Removed write_mode from Summary, introduced partial option parsing earlier

* Handle write-mode parsing in a slightly better way.
2018-04-20 11:14:11 +12:00
Seiichi Uchida
8b731db6ba Output xml header and footer only once 2018-04-12 13:45:12 +09:00
Nick Cameron
f14671131e Make error_on_line_overflow false by default
And improve docs, the error message, etc.

I think false is the better default since such errors should only occur due to a bug in Rustfmt and therefore most users should not be notified of it happening (although to be clear, it might be a 'bug' which only occurs with pathological input and therefore we won't fix it). The error has proven to be confusing and annoying in the past.

Closes #1080
2018-04-09 16:47:55 +12:00
Nick Cameron
b7ba6f70b1
Merge pull request #2576 from topecongiro/merge-imports
Use normalized form to format use items
2018-04-05 17:39:22 +12:00