Seiichi Uchida
5416c4df76
Modify code around ast::Visibility
...
`ast::Visibility` is changed to `codemap::Spanned` whose node is
`ast::VisibilityKind`. This commit fixes it.
Closes #2398 .
2018-03-06 19:47:28 +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
Nick Cameron
b7f01769f9
Merge branch 'master' into init-shorthand
2018-02-01 15:20:01 +13:00
Seiichi Uchida
c60d865b98
Put attributes and enum variants on different lines
2018-01-26 16:20:00 +09:00
Seiichi Uchida
154bf8e1af
Cargo fmt
2018-01-22 13:05:18 +09:00
Nick Cameron
74a957e80f
Merge pull request #2357 from topecongiro/issue-2342
...
Put attributes and struct fields on different line by default
2018-01-12 17:32:55 +13:00
Nick Cameron
b356fc06f7
Merge pull request #2352 from topecongiro/issue-2337
...
Break after colon if static item does not fit in a single line
2018-01-12 17:31:12 +13:00
Seiichi Uchida
2420d346c5
Put attributes and struct fields on different line
2018-01-11 16:57:12 +09:00
Seiichi Uchida
eaab51db2e
Break after colon if static item does not fit in a single line
2018-01-10 23:23:42 +09:00
Seiichi Uchida
cb0b366b38
Cargo fmt
2018-01-10 17:17:06 +09:00
topecongiro
19d6a3c786
Put the opening brace of impl on the next line
...
We put the opening brace on the next line if the following conditions hold:
1. the result before '{' ends with comments or contains newline
2. the last line of the result before '{' is not extendable (i.e. consists of
'>' and whitespaces).
2018-01-04 12:46:55 +09:00
topecongiro
c355f3854c
Use correct budget when rewriting generics of trait
2018-01-04 12:46:05 +09:00
topecongiro
12ddaf93e2
Remove trim_newlines()
...
We call `trim_newlines()` after the `trim()`ed buffer, which is unnecessary.
2018-01-02 13:04:39 +09:00
Seiichi Uchida
f523ec58ab
Do not give up rewriting struct field when attribute is long
2017-12-24 13:57:29 +09:00
Seiichi Uchida
939a6c5820
Get rid of GenericsArg wrapper type
...
`GenericsArg` is basically identical to `ast::GenericParam`.
Just use the latter.
2017-12-24 00:29:59 +09: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
Bastian Köcher
fa67631b32
Fixes compilation with rust version 2017-12-21
2017-12-22 02:52:22 +01:00
topecongiro
1d8619d49a
Fix wrong indentation on type alias
...
Use rewrite_assign_rhs() when rewriting type alias.
2017-12-21 09:58:13 +09:00
topecongiro
3a98b5a5be
Format trait aliases
2017-12-15 13:47:52 +09:00
Seiichi Uchida
516f15aba1
Cargo clippy
2017-12-12 13:48:12 +09:00
Nick Cameron
fc52a4d33f
Merge pull request #2173 from topecongiro/assignment-with-100-chars
...
Assignment whose lhs has 100 chars
2017-12-11 17:04:41 +13:00
Nick Cameron
08022ec1a3
Merge pull request #2265 from topecongiro/issue-2262
...
Fix bugs related to closures
2017-12-11 09:00:56 +13:00
Seiichi Uchida
e3d2f2c2b1
Cargo fmt
2017-12-10 21:54:26 +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
c0eb8c3212
Add FmtVisitor::from_context()
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
Nick Cameron
b07e4339f0
Merge pull request #2221 from topecongiro/rfc/blank-lines
...
Keep vertical spaces between items or statements within range
2017-12-06 15:52:19 +13:00
Seiichi Uchida
026c716168
Cargo fmt
2017-12-03 11:38:16 +09:00
topecongiro
16184d3e16
Cargo fmt and update a test
2017-12-03 11:34:18 +09:00
Seiichi Uchida
89f27764ed
Cargo fmt and update tests
2017-12-02 17:45:39 +09:00
Nick Cameron
076bc2332f
Merge pull request #2213 from topecongiro/issue-2212
...
Format defualtness on specialized impl const
2017-12-01 12:17:10 +13:00
Nick Cameron
c18ba569df
Merge pull request #1889 from topecongiro/match-arm
...
Do not put if on the same line as match arm
2017-12-01 11:56:01 +13:00
Oliver Schneider
ae18c6064a
Run rustfmt
2017-11-30 15:04:19 +01:00
topecongiro
3b36371b78
Format defualtness on specialized impl const
2017-11-30 19:38:05 +09:00
topecongiro
22c9025027
Format source codes
2017-11-30 18:00:49 +09:00
Oliver Schneider
9667cc2484
Address clippy lints
2017-11-30 09:24:10 +01:00
topecongiro
8b53d7806c
Cargo fmt
2017-11-29 17:37:51 +09:00
topecongiro
940758b1bd
Cargo fmt
2017-11-27 21:00:27 +09:00
topecongiro
dff2ebba05
Remove FIXME
...
now is the time
2017-11-27 20:58:39 +09:00
topecongiro
5c81741733
Minor refactoring
2017-11-27 20:57:06 +09:00
topecongiro
261d325e15
Remove width of a trailing comma on variant
2017-11-27 20:54:55 +09:00
Nick Cameron
fcb48786c8
Merge pull request #2191 from topecongiro/issue-2190
...
Recover from failing to format variants even where there is no comment
2017-11-27 18:14:08 +13:00
topecongiro
d5c98008f0
Recover from failing to format variants even where there is no comment
2017-11-27 13:50:01 +09:00
Nick Cameron
677446e99d
Merge fn_empty_single_line and impl_empty_single_line into empty_item_single_line
2017-11-27 17:46:09 +13:00
Nick Cameron
86007e7d17
Remove where_density
and where_layout
options
...
There is a choice between block and visual indent for where clauses, plus the
single line option. I think these two are too fine-grained to be useful.
2017-11-24 21:08:24 +13:00
Nick Cameron
dd1fbca99a
Replace various small width heuristics with a single option
...
Closes #1984
2017-11-24 20:17:06 +13:00
Nick Cameron
20805acf42
Merge attributes_on_same_line_as_field
and attributes_on_same_line_as_variant
into same_line_attributes
2017-11-24 14:29:44 +13:00
Nick Cameron
179b3c59de
Remove legacy option fn_args_paren_newline
2017-11-24 13:27:14 +13:00
Nick Cameron
4f65124422
Remove legacy option fn_return_indent
2017-11-24 13:19:36 +13:00
topecongiro
59ebde26f7
Cargo fmt
2017-11-21 08:52:43 +09:00
Nick Cameron
f987946078
Merge pull request #2161 from topecongiro/issue-1807
...
Implement RFC style for match pattern
2017-11-20 14:51:53 +13:00
topecongiro
d5152fc8c6
Use choose_rhs() for the layout of multi-lined struct field
2017-11-18 15:45:58 +09:00
topecongiro
35466adbfe
Generalize ListItems to allow a separator other than comma
2017-11-16 17:43:36 +09:00
topecongiro
8ef54293e8
Force vertical layout for all variants if one of then use multiple lines
2017-11-16 16:02:01 +09:00
topecongiro
f7ef1f681c
Use rewrite_assign_rhs() when rewriting associated type
2017-11-16 11:31:09 +09:00
topecongiro
4cd2e6f39a
Generalize rewrite_assign_rhs()
2017-11-16 11:26:36 +09:00
topecongiro
bc543cce0b
Combine spaces_within_parens and spaces_within_brackets
2017-11-14 23:42:31 +09:00
topecongiro
babc479783
Use space_before_colon and space_after_colon
2017-11-14 23:25:36 +09:00
topecongiro
f8074b340d
Combine fn_brace_style and item_brace_style
2017-11-14 10:47:02 +09:00
topecongiro
04f09c9d85
Replace '*_indent' with 'indent_style' in src
2017-11-13 17:33:32 +09:00
topecongiro
6b8cd40d07
Format where clause on unit struct
2017-11-13 11:07:09 +09:00
topecongiro
687b26c688
Add BracePos
2017-11-13 11:06:53 +09:00
topecongiro
c485202907
Format generics on unit struct
2017-11-13 08:02:06 +09:00
Seiichi Uchida
4d28e148a5
Return None when there are comments around trait bounds
2017-11-10 21:21:53 +09:00
Seiichi Uchida
76f5bc06c4
Fix a typo
2017-11-10 21:21:06 +09:00
Nick Cameron
0c250d0e5d
Merge pull request #2128 from topecongiro/issue-2125
...
Wrap long single field tuple struct
2017-11-08 21:11:21 +13:00
topecongiro
9337760dd9
Refactor: use less vertical lines
2017-11-08 11:53:13 +09:00
topecongiro
19a3b0b5ca
Use struct prefix as a callee
2017-11-08 11:52:25 +09:00
topecongiro
30959bc16f
Cargo fmt
2017-11-08 08:25:42 +09:00
topecongiro
f39559fef0
Use accessors instead of destucting
2017-11-06 21:48:18 +09:00
topecongiro
082c001843
Add visit_static()
2017-11-06 13:52:25 +09:00
topecongiro
3b2b7f67ee
Add StructParts to reduce the number of args
2017-11-06 13:52:25 +09:00
topecongiro
318f9c89e0
Add StaticParts to reduce the number of args in rewrite_static()
2017-11-06 13:52:25 +09:00
topecongiro
8c6c15a096
Remove unused args from format_generics()
2017-11-06 13:52:25 +09:00
topecongiro
4e1a75a429
Collapse if-else
2017-11-06 13:52:25 +09:00
topecongiro
39ca7db7c8
Remove unnecessary String::from()
2017-11-06 13:52:25 +09:00
topecongiro
1a9d00bbef
Prefer ends_with() to chars().last().unwrap()
2017-11-06 13:52:25 +09:00
topecongiro
6c5ac5a9b3
Remove needless borrows
2017-11-06 13:52:25 +09:00
Afshin Mehrabani
f412c875ea
Adding where_single_line option ( #2030 )
...
* feat(where): adding where_single_line option and tests
* fix(where): adding more tests
* feat(where): changing the shape of where clause when where_single_line is true
* feat: newline_for_brace should avoid adding a new line where where_single_line is true
* fix(items): where_single_line should bypass the multi-item where clauses
* fix(items): refactoring and removing redundant variables
* fix(items): where_single_line should not be functional when args are multilined
* fix(config): fixing conflict with upstream
2017-11-06 11:53:17 +13:00
Nick Cameron
f1035d9782
Merge pull request #2116 from topecongiro/config-options-indent
...
Rename config options related to indent
2017-11-06 08:43:12 +13:00
Nick Cameron
0b481ceced
Merge pull request #2113 from topecongiro/issue-2110
...
Use correct span for tuple struct's body
2017-11-06 08:21:56 +13:00
Pascal Hertleif
536526685d
Fix compile on 2017-11-04 nightly
...
Breakage came from https://github.com/rust-lang/rust/pull/45247/
2017-11-05 12:26:06 +01:00
Anthony Deschamps
18ac341413
Handle case where there is a where clause but no generic parameters.
...
Fixes #2103
2017-11-04 15:25:09 -04:00
topecongiro
55c2000d94
Rename 'fn_args_layout' to 'fn_args_indent'
2017-11-04 22:45:47 +09:00
topecongiro
16302d3578
Use get_bytepos_after_visibility()
2017-11-03 23:53:38 +09:00
topecongiro
3973cdd0a8
Use correct span for tuple struct's body
2017-11-03 23:53:07 +09:00
topecongiro
84526ab87e
Add get_bytepos_after_visibility()
2017-11-03 23:51:19 +09:00
Seiichi Uchida
b0d6d03a25
Use correct budget
2017-10-30 23:38:05 +09:00
Paul Lietar
c1e897907a
Add suport for extern types.
...
See https://github.com/rust-lang/rust/pull/44295
2017-10-30 08:46:11 +13:00
Nick Cameron
96566276e3
Fix build
...
Fixes #2096
2017-10-30 07:39:28 +13:00
Nick Cameron
5233f9cde0
Add support for crate
shorthand for pub(crate)
2017-10-28 18:41:58 +13:00
Nick Cameron
e2a5c78e4b
Merge pull request #2043 from sunjay/lift_generics
...
Lifted generics to account for changes in rust-lang/rust#44766
2017-10-28 18:14:13 +13:00
Nick Cameron
0a59654b41
Merge pull request #2084 from topecongiro/issue-2081
...
Use rewrite_assign_rhs when rewriting unit variant
2017-10-27 02:15:22 +05:30
Nick Cameron
038f711c6e
Merge pull request #2083 from topecongiro/issue-2082
...
Use a correct span for fn with pub(crate) syntax
2017-10-27 02:14:29 +05:30
topecongiro
a67b8b0bbb
Use rewrite_assign_rhs when rewriting unit variant
2017-10-25 01:08:32 +09:00
topecongiro
7b9a4e6a06
Use a correct span for fn with pub(crate) syntax
2017-10-25 00:51:04 +09:00
topecongiro
0d359eacd7
Cargo fmt
2017-10-18 22:23:25 +09:00