Commit Graph

174 Commits

Author SHA1 Message Date
Nick Cameron
c313fb1ddc Merge pull request #1973 from topecongiro/issue-1972
Echo back input from stdin when disable_all_formatting is true
2017-09-18 18:06:49 +12:00
Nick Cameron
cccb7f681e Merge pull request #1966 from topecongiro/string-to-cow
Refactoring: use Cow and etc.
2017-09-18 12:45:25 +12:00
Seiichi Uchida
ede179c62e Echo back input from stdin when disable_all_formatting is true 2017-09-17 22:14:28 +09:00
topecongiro
f0580ae91a Use Cow to avoid unnecessary allocation 2017-09-15 18:21:06 +09:00
topecongiro
f51261e93e Cargo fmt 2017-09-15 12:10:58 +09:00
Seiichi Uchida
e6e696f7b0 Avoid cloning String 2017-09-05 01:04:08 +09:00
Nick Cameron
59d1e84259 Merge pull request #1937 from topecongiro/enhance-macro-rewrite
Enhance macro rewrite
2017-08-31 17:43:52 +12:00
topecongiro
848d4559e1 Enhance macro rewrite 2017-08-31 13:52:13 +09:00
Seiichi Uchida
4b79055a15 Apply refactoring from cargo clippy 2017-08-31 12:49:12 +09:00
Nick Cameron
39a91ba292 Fixup warnings and test formatting 2017-08-31 14:20:47 +12:00
Vadim Petrochenkov
6e5c6f5ba3 Use getters to access Span fields 2017-08-31 14:14:13 +12:00
topecongiro
979d131c5d Format and preserve attributes on ast::Stmt 2017-08-30 19:27:36 +09:00
topecongiro
343b315830 Handle macros with tabs 2017-08-27 13:44:49 +09:00
topecongiro
1f9e7c25c9 Implement Rewrite trait for ast::ForeignItem 2017-08-25 08:19:51 +09:00
Michael Smith
2471248370
Fix typo in comment line overflow message
s/error_on_lineoverflow_comments/error_on_line_overflow_comments
2017-08-18 17:11:29 -07:00
topecongiro
5c50766b36 Print error messages with colors if possible 2017-08-15 16:54:18 +09:00
topecongiro
67285f15eb Enhance error messages
with rustc style
2017-08-15 16:54:07 +09:00
topecongiro
4c39e5aeb8 Add fields to FormattingError
is_comment is set to true if the error happened inside comment.
line_buffer is the line which overflowed.
2017-08-15 16:52:11 +09:00
topecongiro
222ae15c7b No more sorry 2017-08-15 16:49:54 +09:00
topecongiro
840edb2c4f Remove 'mut' notation 2017-08-11 17:54:38 +09:00
topecongiro
e69a2aba18 Add error_on_line_overflow_comments config option 2017-08-10 08:13:20 +09:00
topecongiro
c28df858c7 Format source codes and update tests 2017-08-09 00:16:35 +09:00
topecongiro
60fb11e5dd Do not take inner attributes into account for span 2017-08-05 15:21:46 +09:00
Seiichi Uchida
8b970fcc9f Format inner attributes wherever possible 2017-07-25 00:55:55 +09:00
topecongiro
b233653a22 Cover missing comments between attributes and expressions 2017-07-20 23:58:00 +09:00
topecongiro
6fd291981e Sort imports in alphabetical and consistent order 2017-07-13 18:42:14 +09:00
topecongiro
e3310a6a18 Format source codes 2017-07-11 21:53:10 +09:00
topecongiro
08f3f03353 Implement combining against match arms 2017-07-11 21:52:27 +09:00
topecongiro
65790f2b2a Cover missing comments before and after where 2017-07-10 14:38:16 +09:00
Seiichi Uchida
bc63d69c3f Format source codes 2017-07-10 02:24:59 +09:00
Seiichi Uchida
72b155a9e2 Implement rhs_overhead method against Shape 2017-07-10 02:16:57 +09:00
topecongiro
34b4a9d3c4 Add struct_field_align_threshold for vertical alignment 2017-07-03 18:54:41 +09:00
topecongiro
bd991851c8 Format source codes 2017-07-03 18:54:26 +09:00
topecongiro
7eafad96ad Implement Spanned for ast::StructField and ast::Field 2017-07-03 18:48:21 +09:00
Nick Cameron
5f1bab26c4 Move to Libsyntax 2017-06-14 14:01:56 +12:00
topecongiro
c4d84b44ba Avoid overflow 2017-06-14 00:06:48 +09:00
Nick Cameron
18ccd0190e Rebasing 2017-06-13 14:49:47 +12:00
Nick Cameron
1f512948a0 Reformat source code using new defaults 2017-06-13 14:41:49 +12:00
topecongiro
6e3394e635 Use with_emitter instead of with_tty_emitter 2017-06-13 09:18:14 +09:00
topecongiro
762639e7fd Reset the error count of parser from the previous file 2017-06-10 14:34:50 +09:00
est31
727963afe4 Update syntex_syntax
Bases on commit to switch to libsyntax by @nrc
2017-06-06 07:31:47 +02:00
topecongiro
a9f529cba4 Format source codes 2017-06-04 19:35:29 +09:00
Seiichi Uchida
10c3632078 Format source codes 2017-06-01 12:08:25 +09:00
Nick Cameron
393ba27311 Remove dependency on Itertools 2017-05-25 16:23:07 +12:00
Nick Cameron
80f3b3c9c4 Remove multimap dep 2017-05-25 15:59:06 +12:00
Michael Killough
222bac1397 Provide config.set().item(value) API.
This API isn't fantastic, but it's the best I can come up with without
something like `concat_idents!()`. There are relatively few places where
config is set, to hopefully the ugliness isn't disastrous.

Change previous occurences of `config.item = value` to this new API,
rather than using `config.override_value()`. Undo the changes to
`override_value()`, as it's no longer important to propogate the error
to the caller. Add a test for the new interface.
2017-05-18 11:42:32 +07:00
Michael Killough
c0bdbfa531 Switch to accessing config items via method.
Preparation for #865, which proposes adding a flag which outputs which
config options are used during formatting.

This PR should not make any difference to functionality. A lot of this
was search-and-replace.

Some areas worthy of review/discussion:

 - The method for each config item returns a clone of the underlying
   value. We can't simply return an immutable reference, as lots of
   places in the code expect to be able to pass the returned value as
   `bool` (not `&bool). It would be nice if the `bool` items could
   return a copy, but the more complex types a borrowed reference... but
   unfortunately, I couldn't get the macro to do this.
 - A few places (mostly tests and `src/bin/rustfmt.rs`) were overriding
   config items by modifying the fields of the `Config` struct directly.
   They now use the existing `override_value()` method, which has been
   modified to return a `Result` for use by `src/bin/rustfmt.rs`. This
   benefits of this are that the complex `file_lines` and `write_mode`
   strings are now parsed in one place (`Config.override_value`) instead
   of multiple. The disadvantages are that it moves the compile-time
   checks for config names to become run-time checks.
2017-05-16 15:47:09 +07:00
Nick Cameron
d1682b3473 Merge pull request #1510 from fintelia/better-filelines
Better file_lines
2017-05-15 09:19:18 +12:00
topecongiro
2776615dc9 Replace 'try!' with '?' 2017-05-08 13:14:23 +09:00
topecongiro
4a28be486e Refactor Shape 2017-05-08 07:24:32 +09:00