Commit Graph

528 Commits

Author SHA1 Message Date
Matthew McAllister
c5168405b0 Format attributes on block expressions 2018-03-14 01:16:19 +09:00
Seiichi Uchida
ccd134ed75 Add a test for #2497
Closes #2497.
2018-03-12 07:54:12 +09:00
Seiichi Uchida
b077297179 Modify the placement of the opening brace of trait
Put the opening brace on the next line if

1. putting it one the current line exceeds max width.
2. trait bounds uses multiple lines.
2018-03-12 07:54:12 +09:00
Seiichi Uchida
f56039c7e5 Use rewrite_assign_rhs for rewriting bounds 2018-03-12 07:54:12 +09:00
Seiichi Uchida
6ba7c34433 Use Option<SeparatorTactic> over bool to control trailing comma 2018-03-09 14:07:43 +09:00
Seiichi Uchida
2a99d9704f Use overflow::rewrite_with_angle_brackets to rewrite generics 2018-03-09 14:07:43 +09:00
Seiichi Uchida
ae629abc41 Add overflow module
This commit adds `overflow` module. This module provides two APIs.
`rewrite_with_parens` is basically the same as `rewrite_call_inner`.
`rewrite_with_angle_brackets` is used for rewriting generics and types.
2018-03-09 14:07:43 +09:00
Seiichi Uchida
71ca21fc23 Disallow combining parens and brackets in impl 2018-03-08 19:08:38 +09:00
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