Commit Graph

333 Commits

Author SHA1 Message Date
Seiichi Uchida
19054347ca Fix test failures 2018-06-07 15:20:01 +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
843c12601a Use our own FileName struct rather than exporting libsyntax's 2018-05-21 12:08:39 +12:00
Nick Cameron
abb253df8b Rationalise result and error types 2018-05-21 08:58:53 +12:00
Nick Cameron
2ee8b0e4c5 Remove remove_blank_lines_at_start_or_end_of_block
cc #1974
2018-05-18 16:56:55 +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
topecongiro
bd25c7d0f7 Cargo fmt 2018-05-08 06:25:48 +09:00
topecongiro
e59ceaf954 Do not duplicate attributes on use items 2018-05-06 17:01:14 +09:00
csmoe
f7415bcea2 update self format 2018-04-29 20:53:31 +08:00
Shotaro Yamada
ba792a7fa2 Remove redudant parens 2018-04-01 22:29:26 +09:00
Seiichi Uchida
903de92dae Avoid cloning RewriteContext 2018-03-25 20:20:50 +09:00
Nick Cameron
50c95a074a cargo fmt 2018-03-20 09:27:31 +13:00
Matthew McAllister
c5168405b0 Format attributes on block expressions 2018-03-14 01:16:19 +09:00
Seiichi Uchida
8943c376bc Use RefCell for RewriteContext fields 2018-03-09 14:07:05 +09:00
Nick Cameron
39301ae5f2 Go back to a non-workspace structure
Kinda reverts https://github.com/rust-lang-nursery/rustfmt/pull/2419
2018-03-02 14:58:23 +13:00
topecongiro
4af2aa3a9e Create rustfmt_core crate 2018-02-07 22:48:05 +09:00
Seiichi Uchida
d85e1db178
Merge pull request #2393 from RReverser/macro_rules
Format stable macro_rules
2018-02-05 09:56:26 +09:00
Ingvar Stepanyan
70e7716262 Comments WIP 2018-02-04 11:54:03 +00:00
Seiichi Uchida
3bb0a2a749 Do not reorder items with '#[macro_use]'
Reordering items with `#[macro_use]` could change the semantic of source code.
There could exist other attributes that requires special treatment.
2018-02-04 12:08:02 +09:00
Nick Cameron
30a28a262c Make is_mod_decl more accommodating
Fixes #2403 (I think)
2018-02-02 15:16:29 +13:00
Nick Cameron
b7f01769f9
Merge branch 'master' into init-shorthand 2018-02-01 15:20:01 +13:00
Seiichi Uchida
56c6d73d82 Reorder modules
Add `reorder_modules` config option.

Two things we must keep in mind when reordering modules:
1. We should not reorder modules with attributes, as doing so could
   potentially break the code (e.g. `#[macro_use]`).
2. We should not reorder inline modules e.g. `mod foo { /* .. */ }`.
   We should only reorder module declarations e.g. `mod foo;`.

Some open questions:
1. Should we bring modules with `pub` in front of those without `pub`
   so that they stand out from others?
2. Instead of keeping modules with attributes in the same place,
   can we bring them in front of others? Is this safe?
2018-01-29 21:59:15 +09:00
Seiichi Uchida
154bf8e1af Cargo fmt 2018-01-22 13:05:18 +09:00
Seiichi Uchida
fa782303a6 0.3.5 2018-01-15 21:34:41 +09:00
topecongiro
405360a3fd Refactoring: use methods from libsyntax attr module 2018-01-04 12:49:37 +09:00
Nick Cameron
f86f6dcd9c Format some macros 2.0 macro defs
cc #1539
2018-01-01 19:51:54 +13:00
Seiichi Uchida
1ef6bccea3 Cargo fmt
Run 'cargo fmt' with the following setting:

```
reorder_imports = true
reorder_imports_in_group = true
```
2017-12-24 00:28:58 +09:00
topecongiro
3a98b5a5be Format trait aliases 2017-12-15 13:47:52 +09:00
topecongiro
d60c2ec5d3 Add an initial support for trait aliases 2017-12-15 10:35:07 +09:00
Seiichi Uchida
516f15aba1 Cargo clippy 2017-12-12 13:48:12 +09:00
Seiichi Uchida
414a995926 Replace StringBuffer with String 2017-12-11 09:19:00 +09:00
topecongiro
821d04b2a4 Do not report errors on skipped items or statements 2017-12-08 17:46:43 +09:00
topecongiro
5e6bb3edb0 Keep track of line number in visitor 2017-12-08 16:59:04 +09:00
Seiichi Uchida
3ebe054362 Replace into() on &str with to_owned() 2017-12-08 13:07:42 +09:00
Seiichi Uchida
c776443981 Remove unused lifetime 2017-12-08 13:07:28 +09:00
Seiichi Uchida
d6d8d86e94 Replace &Rc<String> with &str 2017-12-07 17:32:19 +09:00
Seiichi Uchida
c0eb8c3212 Add FmtVisitor::from_context() 2017-12-07 13:57:54 +09:00
Seiichi Uchida
1d9a10e00e Use explicit lifetime to get rid of unsafe code
at least this is why we use Rust
2017-12-07 13:57:54 +09:00
Seiichi Uchida
7c4a84751f Convert '&str' into 'String' whenever necessary 2017-12-07 13:57:52 +09:00
Seiichi Uchida
69a15b2eee Update FmtVisitor::from_codemap() 2017-12-06 22:51:52 +09:00
Seiichi Uchida
0928762562 Use SnippetProvider in FmtVisitor and RewriteContext 2017-12-06 22:49:49 +09:00
Seiichi Uchida
98860ab890 Add SnippetProvider 2017-12-06 22:48:48 +09:00
Seiichi Uchida
228578b9c7 Add count_newlines() utility function 2017-12-05 15:17:40 +09:00
Seiichi Uchida
483f71c8b1
Merge pull request #2218 from pietroalbini/fix-ast-for-use_nested_groups
Fix broken build after use_nested_groups lands on nightly
2017-12-02 16:34:16 +09:00
Pietro Albini
9d8cfbcd93
Fix imports formatting broken after AST change 2017-12-01 00:18:00 +01:00
topecongiro
22c9025027 Format source codes 2017-11-30 18:00:49 +09:00
Seiichi Uchida
f99b775de7 Rename is_dummy to has_braces 2017-11-30 06:40:29 +09:00
Seiichi Uchida
b5e4c99ca7 Use an explicit flag to decide on whether to add brace compensation 2017-11-30 06:12:32 +09:00
topecongiro
8b53d7806c Cargo fmt 2017-11-29 17:37:51 +09:00
topecongiro
35466adbfe Generalize ListItems to allow a separator other than comma 2017-11-16 17:43:36 +09:00