49 Commits

Author SHA1 Message Date
Ruben Schmidmeister
618d092bf7
Enable unreachable_pub lint 2019-05-09 20:37:51 +02:00
Seiichi Uchida
5dd042c152
Merge pull request #3511 from topecongiro/issue3498
Avoid overflowing item with attributes
2019-04-17 11:40:00 -07:00
topecongiro
d3e578b131 Avoid overflowing item if it has attributes 2019-04-14 20:45:04 +09:00
Shotaro Yamada
ff0683d666 Simplify iterators 2019-03-29 19:06:32 +09:00
Alexander Regueiro
7a3b7c9275 Various cosmetic improvements (#3403) 2019-02-19 11:56:42 +09:00
Seiichi Uchida
ce682bdabc
Merge pull request #3335 from h-michael/rust-2018
Rust 2018 idioms
2019-02-11 01:12:38 +09:00
topecongiro
9a7ea6aacb Handle a macro argument with a single keyword
Closes #3331.
2019-02-11 00:34:23 +09:00
Hirokazu Hata
8183b949c4 cargo fmt 2019-02-09 16:20:38 +09:00
Hirokazu Hata
4bb90f5cc8 Fix rust_2018_idioms warnings 2019-02-09 16:14:30 +09:00
Evgenii
ece629b1cc transition to Rust 2018 2019-02-04 13:30:43 +03:00
topecongiro
154ccf6a02 Do not force trailing comma when using mixed layout 2019-01-31 23:44:58 +09:00
topecongiro
181ca427dc Use the same rule with macro and function calls with a single chain 2019-01-28 23:05:42 +09:00
topecongiro
5df0a18849 Avoid putting a long macro call in a single line 2019-01-28 23:05:39 +09:00
wada314
a01990c4d0 Use Unicode-standard char width to wrap comments or strings. (#3275) 2019-01-15 08:41:09 +09:00
Kevin Stenerson
25b828d35f Add config option to more aggressively allow overflow 2018-11-05 21:12:40 -07:00
Matthias Krüger
8c996331cc fix a couple of clippy lint warnings
simplify a comparison with "true"
fn can_be_overflowed: remove unused lifetime
fn rewrite_pairs_one_line: pass "list" by reference (it is not consumed in the function)
fn span_for_token_stream: pass "token_stream" by reference since it is not consumed
use tool lints for clippy suppressions
2018-10-19 01:11:28 +02:00
Nick Cameron
613dfcc521 Remove various feature flags 2018-10-18 15:38:57 +13:00
Shotaro Yamada
751bcf5fa0 Clippy 2018-10-15 23:59:08 +09:00
Otavio Salvador
ef59b34cd7 Avoid control flow expressions conditions to go multi line
Extends the multi line condition to over other control flow
expressions, it now covers: `if`, `if let`, `for`, `loop`, `while`,
`while let` and `match`.

Refs: #3029

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2018-10-13 14:12:43 -03:00
Otavio Salvador
8feeddf1f8 Only combine match if its condition expression fits in a single line
This improves the formatting and reading of code avoiding the
condition expression to be rewrite, if it goes multi line.

Fixes: #3029.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2018-10-12 20:12:45 -03:00
Seiichi Uchida
d7e1f0006a Put arguments of the fail attribute on the same line as println! 2018-09-30 08:05:45 +09:00
Seiichi Uchida
052ba6c5df Move maybe_get_args_offset to overflow.rs 2018-09-30 08:05:45 +09:00
Seiichi Uchida
63387824b3 Avoid using to_expr as much as possible 2018-09-30 08:05:45 +09:00
Seiichi Uchida
c302409f56 Get rid of ToExpr trait 2018-09-30 08:05:35 +09:00
Seiichi Uchida
755d27a424 Take impl Iterator for overflow routines 2018-09-29 14:33:00 +09:00
Seiichi Uchida
e2b9c66cc9 Cargo fmt 2018-09-19 23:22:26 +09:00
Maximilian Roos
7d60e3a1ad
more clippy 2018-08-28 21:57:08 -04:00
Maximilian Roos
df72570b58
set of clippy changes 2018-08-28 00:33:51 -04: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
Seiichi Uchida
024c03e81b Use builder pattern for ListFormatting 2018-08-03 22:13:20 +09:00
Nick Cameron
486f8fd8e7 Fixup formatting of tests and source 2018-07-12 21:37:28 +12:00
topecongiro
e7c6c29562 Avoid panicking on deeply nested expressions 2018-07-01 10:46:32 +09:00
Josh Chase
ee5ff2d9e8 Add flag to the ListFormatting struct for nested imports 2018-06-19 12:13:35 -04:00
Seiichi Uchida
b4987d848b Allow using mixed layout with comments 2018-06-05 13:43:01 +09:00
topecongiro
fbcc886338 Disallow combining a method call with prefix or suffix 2018-05-23 07:22:42 +09:00
Nick Cameron
d726492e65 Remove spaces_within_parens_and_brackets
cc #1974
2018-05-18 16:35:09 +12:00
Shotaro Yamada
d1e2b80fb9 Use saturating_sub 2018-05-15 20:41:43 +09:00
topecongiro
bd25c7d0f7 Cargo fmt 2018-05-08 06:25:48 +09:00
topecongiro
1f738ea208 Cargo fmt 2018-05-06 15:22:29 +09:00
topecongiro
f885039e6c Do not overflow a long item
Take the first line's width of a single item into account when
trying to overflow something.

Closes #2676.
2018-05-06 12:12:16 +09:00
csmoe
f7415bcea2 update self format 2018-04-29 20:53:31 +08:00
memoryleak47
d48cbedfe4 typo (#2598)
* typo

* more typos
2018-04-05 12:47:09 +09:00
Seiichi Uchida
98c6f7b731 Format array using overflow module
This commit applies heuristics used for function calls to array
and vice versa.
2018-03-26 07:36:44 +09:00
Seiichi Uchida
affa4ce1ec Factor out default_tactic and fix indentation
rustfmt fails to handle binary expressions with comments in-between.
2018-03-26 07:34:17 +09:00
Seiichi Uchida
903de92dae Avoid cloning RewriteContext 2018-03-25 20:20:50 +09:00
Nick Cameron
a76d9b529a format code and tests 2018-03-20 09:27:31 +13:00
Seiichi Uchida
6ba7c34433 Use Option<SeparatorTactic> over bool to control trailing comma 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