Commit Graph

320 Commits

Author SHA1 Message Date
Nick Cameron
6739dbe77d
Merge pull request #3129 from otavio/issue-3104
cargo-fmt: detect Rust edition in use
2018-10-25 13:39:40 +13:00
Stéphane Campinas
2f5d864c08
keep track of lines which formatting was disabled in order to prevent indentation which would cause code right-shifting 2018-10-24 12:11:11 +02:00
Otavio Salvador
2eab9714e4 lib: export config::Edition so it can be used externally
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2018-10-23 02:33:36 -03:00
Matthias Krüger
b25f974c0d fix a few typos found via codespell. 2018-10-19 12:28:00 +02:00
Nick Cameron
4bb84f6002 Remove NLL feature
And do some refactoring in comments.rs

Closes #3107
2018-10-18 15:39:11 +13:00
Nick Cameron
613dfcc521 Remove various feature flags 2018-10-18 15:38:57 +13:00
Seiichi Uchida
8c4e92a14e
Catch parser panic in format_snippet (#3103) 2018-10-17 14:21:04 +09:00
Otavio Salvador
e203057db0 utils: rewrite count_newlines using bytecount::count
This uses a optimized byte count and also makes use of SIMD
instructions to optimize the processing of the byte arrays.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2018-10-14 18:27:35 -03:00
Stéphane Campinas
7003276b73
fixed display message for the LineOverflow error 2018-10-11 09:05:33 +02:00
Otavio Salvador
0279b7d02c Replace isatty crate with atty
The `isatty` crate has been deprecated and a replacement has been
released for it called `atty`. It offers a nicer API and the code
change to adapt is trivial.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2018-10-08 14:39:16 -03:00
Seiichi Uchida
6e901c8f37 Format and update test 2018-09-30 08:05:45 +09:00
Nick Cameron
88f3b32e43 Remove unnecessary feature flag 2018-09-25 18:23:17 +12:00
Seiichi Uchida
6aae9d870f Remove an unnecessary attribute 2018-08-26 13:20:07 +09:00
cad97
fc1909d311 Reformat 2018-08-23 17:14:19 -04:00
cad97
04d804c365 Rename CodeMap/FileMap to SourceMap/SourceFile
#2946
2018-08-23 17:10:46 -04:00
Nick Cameron
43f178bd58 Remove Summary 2018-07-24 21:45:15 +12:00
Nick Cameron
d3288841ea Refactoring: factor format_lines and format_project into smaller chunks 2018-07-24 15:17:47 +12:00
Nick Cameron
2af1ed109c Refactoring: factor out format_file and FormatHandler
This effectively separates out formatting from other handling.
2018-07-24 14:05:04 +12:00
Nick Cameron
b9c6754d8c Refactoring: move format_project and Timer out of Session 2018-07-24 10:08:41 +12:00
Nick Cameron
069c4fc508 Refactoring: summary
Move the timer from Summary to Session.

Move Summary from config to formatting.
2018-07-24 08:43:30 +12:00
Nick Cameron
09a8c6d22b Refactoring: move code around in formatting
To try and make cleaner abstractions and to start to separate formatting from
other tasks.
2018-07-24 08:26:33 +12:00
Nick Cameron
71d3d04270 factor out a Session object 2018-07-23 15:37:34 +12:00
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