193 Commits

Author SHA1 Message Date
rchaser53
2c58b205d5 fix Comma in comment causes no formatting 2019-04-29 21:38:38 +09:00
Matthias Krüger
4352681d62 fix clippy warnings
clippy::needless_return
clippy::redundant_closure
clippy::or_fun_call
clippy::len_zero
clippy::expect_fun_call
clippy::assertions_on_constants
clippy::identity_conversion
clippy::chars_last_cmp
2019-04-11 13:48:13 +02:00
Seiichi Uchida
dfa94d1505
Merge pull request #3480 from sinkuu/cleanup
Cleanups
2019-03-29 22:07:19 +09:00
Shotaro Yamada
c0ff894a22 Fix indexing panic on unicode whitespaces 2019-03-29 20:12:45 +09:00
Shotaro Yamada
ff0683d666 Simplify iterators 2019-03-29 19:06:32 +09:00
rchaser53
f0c861bfa9 implement for const generics 2019-03-13 03:58:23 +09:00
rchaser53
dec3902076 leave post comment for self 2019-03-02 17:33:43 +09:00
Alexander Regueiro
7a3b7c9275 Various cosmetic improvements (#3403) 2019-02-19 11:56:42 +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
Philipp Hansch
d0785954c8 Fix trim_right/trim_left deprecation warnings (#3252) 2018-12-18 11:21:31 +09:00
Nick Cameron
dd7add784b Don't align comments on extern crates
Closes #3128
2018-11-15 21:38:01 +13: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
c09d7ef088
Merge pull request #3106 from sinkuu/clippy
Clippy and cleanups
2018-10-16 09:09:56 +13:00
Shotaro Yamada
751bcf5fa0 Clippy 2018-10-15 23:59:08 +09:00
Nick Cameron
cbd568083d Fixup formatting 2018-10-15 11:52:27 +13:00
Emilio Cobos Álvarez
66c15e46ba
lists: Detect block comment by starting from the end.
The issue with the current code is that comments are collapsed, so comments like
the one from the test end up in a string like:

```
"// this is a single line comment\n/* block = */"
```

I chose to fix it by detecting whether we're in a block comment starting from
the end instead, and tested a single-line comment ended in `*/` just for sanity,
ensuring line breaks are not removed in that case, which would break the
formatting.

The right fix eventually is probably to lex the comments properly, but this does
the work for now, I guess :)

Fixes #3025
2018-09-22 12:16:38 +02:00
Maximilian Roos
968affc3e0
final clippy changes 2018-09-01 16:32:38 -04:00
Maximilian Roos
df72570b58
set of clippy changes 2018-08-28 00:33:51 -04:00
cad97
04d804c365 Rename CodeMap/FileMap to SourceMap/SourceFile
#2946
2018-08-23 17:10:46 -04:00
Nick Cameron
66d3924aa8
Merge pull request #2899 from topecongiro/chain-with-comments
Format chains with comment
2018-08-07 15:07:23 +12:00
Seiichi Uchida
24fccdc45c Factor out functions that extract comments around items 2018-08-05 19:55:03 +09:00
Seiichi Uchida
1a6df18d6f Remove pub(self) 2018-08-04 08:47:48 +09:00
Seiichi Uchida
024c03e81b Use builder pattern for ListFormatting 2018-08-03 22:13:20 +09:00
Nick Cameron
b28a0cd6e6 Fix an anomaly with comments and array literals
Closes #2842
2018-07-17 15:40:19 +12:00
Nick Cameron
229a55248b address reviewer comments 2018-07-12 22:21:07 +12:00
Nick Cameron
486f8fd8e7 Fixup formatting of tests and source 2018-07-12 21:37:28 +12:00
Nick Cameron
42f03458dd Refactor and fixup attribute formatting
Preserves trailing commas (except in derives where we follow function args).
Correctly uses `#` vs `#!` for derives.
Uses block indent for derives, fixes #2805.
2018-06-26 15:18:17 +12:00
Nick Cameron
87edd75ecf TODO -> FIXME
Or just delete

Closes #25
2018-06-22 14:42:27 +12:00
Josh Chase
ee5ff2d9e8 Add flag to the ListFormatting struct for nested imports 2018-06-19 12:13:35 -04:00
Josh Chase
2077855e00 Remove NestedImport tactic 2018-06-19 12:13:26 -04:00
Seiichi Uchida
42ab258757 Put each nested import on its own line
while putting non-nested imports on the same line as much as possible.
2018-06-05 19:58:44 +09:00
Seiichi Uchida
b4987d848b Allow using mixed layout with comments 2018-06-05 13:43:01 +09: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
Seiichi Uchida
ac8ae00625
Cargo update and clippy (#2643) 2018-04-25 07:21:23 +09:00
Nick Cameron
55dd8f1df0
Merge pull request #2603 from topecongiro/merge-nested-imports
Merge imports
2018-04-12 16:40:06 +12:00
Seiichi Uchida
e58e97783e Preserve trailing comma on macro call when using mixed layout 2018-04-12 09:54:00 +09:00
Seiichi Uchida
1954513ace Merge imports with the same prefix into a single nested import 2018-04-10 12:36:57 +09:00
Nick Cameron
4b2160e1b2
Merge pull request #2599 from topecongiro/issue-2596
Use multiple lines for imports list which exceeds max width
2018-04-06 11:12:53 +12:00
Seiichi Uchida
97ec417e74 Add trailing comma when using mixed layout with block indent 2018-04-05 13:27:42 +09:00
Seiichi Uchida
01311c63ec Format normalized use item
This commit implements `Rewrite` trait on `UseTree`, which is a normalized
form of `ast::UseTree` for rustfmt.
2018-03-31 14:23:36 +09:00
Seiichi Uchida
2b682b8ed5 Do not include separator to post comment
This prevents the trailing `;` on use item to be treated as comment.
2018-03-31 13:19:55 +09:00
Seiichi Uchida
a8022f3862 Do not insert newline when item is empty
This change is necessary when we remove unused imports (`use std::{};`).
2018-03-31 13:18:53 +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
Nick Cameron
0cf80dcce7 Better handle comments and newlines around erased imports 2018-03-20 09:27:31 +13: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
154bf8e1af Cargo fmt 2018-01-22 13:05:18 +09:00