]>
git.lizzy.rs Git - rust.git/log
Seiichi Uchida [Tue, 30 Oct 2018 06:26:53 +0000 (15:26 +0900)]
Merge pull request #3155 from emilio/missed-spans-bug
missed-spans: Fix bogus check.
Emilio Cobos Álvarez [Tue, 30 Oct 2018 02:11:14 +0000 (03:11 +0100)]
missed-spans: Fix bogus check.
I don't really know what it's trying to do, but forgetting about everything
you've seen before when you see whitespace followed by a semicolon doesn't look
right to me, and absolutely no tests were hitting that.
This check was introduced in
5ecdd072d6745cd70ec7c37eea8dbf1f3ee42f2e , however
it was wrong even at that point, and now rustfmt still passes that test,
regardless of macro name.
Fixes #3154.
Seiichi Uchida [Mon, 29 Oct 2018 14:01:51 +0000 (23:01 +0900)]
Merge pull request #3150 from flip1995/patch-1
Remove deprecated cfg_attr from README
Seiichi Uchida [Mon, 29 Oct 2018 13:53:29 +0000 (22:53 +0900)]
Use edition in rustfmt.toml when no command line argument is passed
Philipp Krones [Mon, 29 Oct 2018 09:27:19 +0000 (10:27 +0100)]
Remove deprecated cfg_attr from README
`tool_attributes` are stable since 1.30. The old `cfg_attr(rustfmt, rustfmt_skip)` attributes aren't necessary anymore and everyone should switch to `#[rustfmt::skip]` sooner or later.
There is also a Clippy lint in the making for this: rust-lang-nursery/rust-clippy#3123
Nick Cameron [Sun, 28 Oct 2018 22:29:51 +0000 (11:29 +1300)]
Merge pull request #3141 from dfyz/issue-2810
Try to fix formatting failures on Windows (issue #2810)
Nick Cameron [Sun, 28 Oct 2018 22:22:05 +0000 (11:22 +1300)]
Merge pull request #3144 from otavio/issues-3143
cargo-fmt: Fix splitting of targets across editions
Nick Cameron [Sun, 28 Oct 2018 22:08:38 +0000 (11:08 +1300)]
Merge pull request #3142 from topecongiro/issue-3139
Do not remove path disambiugator inside macro
Ivan Komarov [Sat, 27 Oct 2018 01:01:37 +0000 (04:01 +0300)]
Fix formatting failures on Windows
When newline_style is set to Windows, an empty line inside of a macro
results in `\r` being passed to the `fold()` in `MacroBranch::rewrite()`.
`\r` is technically not an empty string, so we try to indent it, leaving
trailing whitespaces behind, even though that was not intended
(as far as I can see).
This commit replaces the `!l.is_empty()` check with calling
`is_empty_line()`, since trying to indent any whitespace-only string
will probably result in problematic trailing whitespaces.
Fixes: #2810
Otavio Salvador [Sat, 27 Oct 2018 14:55:41 +0000 (11:55 -0300)]
cargo-fmt: Fix splitting of targets across editions
When I reworked the code, it ended not generating the complete list of
need targets. Fix it.
Fixes: #3143.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Otavio Salvador [Sat, 27 Oct 2018 14:49:48 +0000 (11:49 -0300)]
cargo-fmt: Add --edition when printing the command
By mistake, it was forgotten to print out the edition in use when
printing the rustcmd command. Fix it.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Seiichi Uchida [Sat, 27 Oct 2018 02:22:40 +0000 (11:22 +0900)]
Do not remove path disambiugator inside macro
Seiichi Uchida [Sat, 27 Oct 2018 02:22:18 +0000 (11:22 +0900)]
Add a test for #3139
Nick Cameron [Fri, 26 Oct 2018 23:29:59 +0000 (12:29 +1300)]
Merge pull request #3140 from matthiaskrgr/redundant_clones
fix clippy::redundant_clones warnings.
Matthias Krüger [Fri, 26 Oct 2018 12:45:25 +0000 (14:45 +0200)]
fix clippy::redundant_clones warnings.
Nick Cameron [Fri, 26 Oct 2018 08:26:26 +0000 (21:26 +1300)]
Merge pull request #3138 from topecongiro/issue-3137
Simplify handling of parens around generic bound trait
Seiichi Uchida [Fri, 26 Oct 2018 07:36:11 +0000 (16:36 +0900)]
Simplify handling parens on generic bound trait
Seiichi Uchida [Fri, 26 Oct 2018 07:36:01 +0000 (16:36 +0900)]
Add a test for #3137
Nick Cameron [Thu, 25 Oct 2018 02:03:59 +0000 (15:03 +1300)]
Merge pull request #3134 from otavio/issue-3104
Stabilize `edition` configuration option
Otavio Salvador [Thu, 25 Oct 2018 01:31:42 +0000 (22:31 -0300)]
Stabilize `edition` configuration option
Refs: #3104.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Nick Cameron [Thu, 25 Oct 2018 01:35:42 +0000 (14:35 +1300)]
Merge pull request #3133 from otavio/rework-readme
README: remove old requirement for Rust 2018 edition use
Otavio Salvador [Tue, 23 Oct 2018 04:50:27 +0000 (01:50 -0300)]
README: remove old requirement for Rust 2018 edition use
From now on, the `Cargo.toml` is taken into account when triggering
formatting using `cargo fmt`.
It is considered editor's duty to pass the proper `--edition` argument
for `rustfmt` if it is being called manually.
Refs: #3104.
Refs: #3129.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Nick Cameron [Thu, 25 Oct 2018 00:39:40 +0000 (13:39 +1300)]
Merge pull request #3129 from otavio/issue-3104
cargo-fmt: detect Rust edition in use
Nick Cameron [Wed, 24 Oct 2018 23:09:12 +0000 (12:09 +1300)]
Merge pull request #3113 from scampi/issue3105
Fix handling of code that is annotated with rustfmt::skip.
Otavio Salvador [Tue, 23 Oct 2018 05:33:46 +0000 (02:33 -0300)]
cargo-fmt: Take into account the edition for each target
When formatting the crate, with `cargo fmt`, it parses each target
with the specific Rust edition.
Fixes: #3104.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Stéphane Campinas [Tue, 23 Oct 2018 23:24:56 +0000 (01:24 +0200)]
keep track of lines which formatting was disabled in order to prevent indentation which would cause code right-shifting
Stéphane Campinas [Thu, 18 Oct 2018 20:58:45 +0000 (22:58 +0200)]
Fix handling of code that is annotated with rustfmt::skip.
A rustfmt::skip'ed block is indented although original lines are
returned. In order to resolve this, the leading whitespaces are trimmed
on each line while retaining the layout; this leaves the skipped code
to be indented as necessary by the caller.
Nick Cameron [Wed, 24 Oct 2018 05:13:42 +0000 (18:13 +1300)]
Merge pull request #3130 from JoshBrudnak/master
Added crates to the non-alphabetical treated imports
Nick Cameron [Wed, 24 Oct 2018 05:13:26 +0000 (18:13 +1300)]
Remove the source test file
Nick Cameron [Wed, 24 Oct 2018 02:07:09 +0000 (15:07 +1300)]
Revert "Use `width_heuristics` in the options docs"
This reverts commit
fa3cadf62c11cd8163f08029026a8475ad2b60fd .
Nick Cameron [Wed, 24 Oct 2018 02:01:14 +0000 (15:01 +1300)]
Merge pull request #3116 from kellerkindt/patch-1
Add howto for CLion / IntelliJ IDE integration
JoshBrudnak [Tue, 23 Oct 2018 23:00:42 +0000 (19:00 -0400)]
Added test for crate non-alphabetizing
kellerkindt [Tue, 23 Oct 2018 07:07:46 +0000 (09:07 +0200)]
Add howto for CLion / IntelliJ IDE integration
JoshBrudnak [Mon, 22 Oct 2018 22:49:10 +0000 (18:49 -0400)]
Treat crates non-alphabetically Fixes: #3118
Otavio Salvador [Tue, 23 Oct 2018 05:33:38 +0000 (02:33 -0300)]
rustfmt: add support to specify the Rust edition as argument
The new `--edition` command line argument allow the setting of the
desired Rust edition to be used.
Refs: #3104.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Otavio Salvador [Tue, 23 Oct 2018 05:33:36 +0000 (02:33 -0300)]
lib: export config::Edition so it can be used externally
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Otavio Salvador [Tue, 23 Oct 2018 05:33:33 +0000 (02:33 -0300)]
config: use 2015 as default Edition
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Otavio Salvador [Tue, 23 Oct 2018 05:33:30 +0000 (02:33 -0300)]
Cargo.lock: update `cargo_metadata` to 0.6.1 release
The update is especially important as it adds support for the
`edition` field handling, when parsing `cargo` metadata.
Refs: #3104.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Otavio Salvador [Tue, 23 Oct 2018 05:33:25 +0000 (02:33 -0300)]
rustfmt: avoid duplicating the error handling for `--emit`
There is no need to produce the error message again as it is already
produced by the helper method that does the emit mode validation.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Nick Cameron [Tue, 23 Oct 2018 01:59:14 +0000 (14:59 +1300)]
Use `width_heuristics` in the options docs
It was using an older name
Nick Cameron [Mon, 22 Oct 2018 21:35:32 +0000 (10:35 +1300)]
Merge pull request #3126 from topecongiro/issue-3117
Use correct width when formatting type on local statement
Seiichi Uchida [Mon, 22 Oct 2018 13:22:31 +0000 (22:22 +0900)]
Merge pull request #3114 from matthiaskrgr/typos
fix a few typos found via codespell.
Seiichi Uchida [Mon, 22 Oct 2018 13:20:25 +0000 (22:20 +0900)]
Use correct width when formatting type on local statement
Seiichi Uchida [Mon, 22 Oct 2018 13:17:16 +0000 (22:17 +0900)]
Add a test for #3117
Matthias Krüger [Thu, 18 Oct 2018 22:44:14 +0000 (00:44 +0200)]
fix a few typos found via codespell.
Seiichi Uchida [Fri, 19 Oct 2018 08:05:33 +0000 (17:05 +0900)]
Merge pull request #3115 from matthiaskrgr/clippy
fix a couple of clippy lint warnings
Matthias Krüger [Thu, 18 Oct 2018 23:11:28 +0000 (01:11 +0200)]
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
Nick Cameron [Thu, 18 Oct 2018 06:56:17 +0000 (19:56 +1300)]
Merge pull request #3109 from scampi/issue-3038
force a newline after the `if` condition if there is a different indentation level
Nick Cameron [Thu, 18 Oct 2018 02:44:31 +0000 (15:44 +1300)]
Update rustc-ap-syntax
Nick Cameron [Wed, 17 Oct 2018 22:45:55 +0000 (11:45 +1300)]
Remove NLL feature
And do some refactoring in comments.rs
Closes #3107
Nick Cameron [Wed, 17 Oct 2018 20:55:21 +0000 (09:55 +1300)]
Remove various feature flags
Alex Crichton [Wed, 17 Oct 2018 19:47:21 +0000 (12:47 -0700)]
Add `rustc-workspace-hack` workaround like RLS/Cargo
Seiichi Uchida [Wed, 17 Oct 2018 05:21:04 +0000 (14:21 +0900)]
Catch parser panic in format_snippet (#3103)
Stéphane Campinas [Mon, 15 Oct 2018 21:24:35 +0000 (23:24 +0200)]
force a newline after the `if` condition if there is a different
indentation level
Nick Cameron [Mon, 15 Oct 2018 20:09:56 +0000 (09:09 +1300)]
Merge pull request #3106 from sinkuu/clippy
Clippy and cleanups
Nick Cameron [Mon, 15 Oct 2018 20:06:15 +0000 (09:06 +1300)]
Merge pull request #3102 from nrc/arm-guard-newline
Only put `{` on a newline in a match arm where necessary
Nick Cameron [Mon, 15 Oct 2018 20:01:40 +0000 (09:01 +1300)]
Merge pull request #3101 from nrc/pair-newline
Simplify multi-lining binop exprs
Shotaro Yamada [Mon, 15 Oct 2018 14:50:01 +0000 (23:50 +0900)]
Cargo.lock
Shotaro Yamada [Mon, 15 Oct 2018 12:20:03 +0000 (21:20 +0900)]
Reduce allocations
Shotaro Yamada [Mon, 15 Oct 2018 12:10:34 +0000 (21:10 +0900)]
Use concat() instead of join("")
Shotaro Yamada [Wed, 10 Oct 2018 01:50:25 +0000 (10:50 +0900)]
Cleanup
Shotaro Yamada [Mon, 15 Oct 2018 11:36:39 +0000 (20:36 +0900)]
Clippy
Shotaro Yamada [Tue, 9 Oct 2018 12:47:00 +0000 (21:47 +0900)]
Use UnOp::to_string
Shotaro Yamada [Tue, 9 Oct 2018 12:28:40 +0000 (21:28 +0900)]
Remove an unsafe code
Daniele D'Orazio [Mon, 15 Oct 2018 02:18:37 +0000 (04:18 +0200)]
try to fix comment bad wrapping (#3099)
Nick Cameron [Mon, 15 Oct 2018 01:09:31 +0000 (14:09 +1300)]
Add test (issue 3005)
Nick Cameron [Mon, 15 Oct 2018 01:06:52 +0000 (14:06 +1300)]
Only put `{` on a newline in a match arm where necessary
Fixes #3005
Nick Cameron [Sun, 14 Oct 2018 23:09:53 +0000 (12:09 +1300)]
add test
Nick Cameron [Sun, 14 Oct 2018 23:07:58 +0000 (11:07 +1200)]
Merge pull request #3096 from otavio/use-bytecount-count
utils: rewrite `count_newlines` using `bytecount::count`
Nick Cameron [Sun, 14 Oct 2018 22:52:27 +0000 (11:52 +1300)]
Fixup formatting
Nick Cameron [Sun, 14 Oct 2018 22:48:12 +0000 (11:48 +1300)]
Simplify situations in which the last sub-expr in a bin-op can go multiline without making the whole expr multiline
Fixes #3034
Otavio Salvador [Sat, 13 Oct 2018 20:39:19 +0000 (17:39 -0300)]
utils: rewrite `count_newlines` using `bytecount::count`
This uses a optimized byte count and also makes use of SIMD
instructions to optimize the processing of the byte arrays.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Nick Cameron [Sun, 14 Oct 2018 20:07:59 +0000 (08:07 +1200)]
Merge pull request #3100 from topecongiro/issue-3092
Fix poor formatting of empty trait with generic bounds
Nick Cameron [Sun, 14 Oct 2018 19:57:39 +0000 (07:57 +1200)]
Merge pull request #3093 from scampi/issue2633
do not vertically align list items in case the tactic is Horizontal
Nick Cameron [Sun, 14 Oct 2018 19:40:34 +0000 (07:40 +1200)]
Merge pull request #3091 from topecongiro/issue-3060
Do not add parens around lifetimes
Seiichi Uchida [Sun, 14 Oct 2018 12:44:56 +0000 (21:44 +0900)]
Use correct width
When rewriting trait bounds on the next line, we do not want to add an extra
indentation. However, the max width should be smaller.
Seiichi Uchida [Sun, 14 Oct 2018 12:43:59 +0000 (21:43 +0900)]
Add a correct indent before trait's closing brace with empty body
Seiichi Uchida [Sun, 14 Oct 2018 12:43:35 +0000 (21:43 +0900)]
Add a test for #3092
Seiichi Uchida [Sun, 14 Oct 2018 12:03:27 +0000 (21:03 +0900)]
Merge pull request #3095 from otavio/avoid-overflow-control-flow-expr
Avoid control flow expressions conditions to go multi line
Seiichi Uchida [Sun, 14 Oct 2018 12:02:39 +0000 (21:02 +0900)]
Merge pull request #3094 from otavio/avoid-unwrap-or
Replace `.unwrap_or` with `.map_or` in few places
Otavio Salvador [Sat, 13 Oct 2018 12:05:54 +0000 (09:05 -0300)]
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>
Stéphane Campinas [Sat, 13 Oct 2018 07:57:43 +0000 (09:57 +0200)]
handle lines prefixed with a # inside code blocks
Seiichi Uchida [Sat, 13 Oct 2018 01:36:31 +0000 (10:36 +0900)]
Merge pull request #3090 from otavio/issue-3029
Only combine `match` if its condition expression fits in a single line
Otavio Salvador [Fri, 12 Oct 2018 23:22:10 +0000 (20:22 -0300)]
bin: replace `.unwrap_or` with `.map_or`
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Otavio Salvador [Fri, 12 Oct 2018 23:21:48 +0000 (20:21 -0300)]
config: replace `.unwrap_or` with `.map_or`
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Otavio Salvador [Fri, 12 Oct 2018 23:21:22 +0000 (20:21 -0300)]
expr: replace `.unwrap_or` with `.map_or`
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Otavio Salvador [Mon, 8 Oct 2018 23:49:33 +0000 (20:49 -0300)]
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>
Otavio Salvador [Fri, 12 Oct 2018 23:07:25 +0000 (20:07 -0300)]
closures: replace `.unwrap_or` with `.map_or`
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Stéphane Campinas [Fri, 12 Oct 2018 18:41:56 +0000 (20:41 +0200)]
do not vertically align list items in case the tactic is Horizontal
Seiichi Uchida [Fri, 12 Oct 2018 15:41:17 +0000 (00:41 +0900)]
Do not add parens around lifetimes
Parens should be added only around trait objects.
Seiichi Uchida [Fri, 12 Oct 2018 15:40:34 +0000 (00:40 +0900)]
Add a test for #3060
Nick Cameron [Fri, 12 Oct 2018 02:17:27 +0000 (15:17 +1300)]
Add `attr_fn_like_width` to the width heuristics
It is a bit larger than than `fn_call_width` which we used previously, so fewer attributes get reformatted.
Closes #2929
Nick Cameron [Thu, 11 Oct 2018 21:55:45 +0000 (09:55 +1200)]
Merge pull request #3089 from topecongiro/format-comment
Add format_doc_comments
Nick Cameron [Thu, 11 Oct 2018 21:45:33 +0000 (09:45 +1200)]
Merge pull request #3086 from otavio/bump-rustc-ap-272
Update rustc-ap-* to 272.0.0
Seiichi Uchida [Thu, 11 Oct 2018 14:10:57 +0000 (23:10 +0900)]
Add format_doc_comments
Seiichi Uchida [Thu, 11 Oct 2018 13:52:17 +0000 (22:52 +0900)]
Merge pull request #3088 from otavio/fix-misleading-comment
rewrite: adjust comment as it refers to `is_if_else_block`
Otavio Salvador [Thu, 11 Oct 2018 13:21:15 +0000 (10:21 -0300)]
rewrite: adjust comment as it refers to `is_if_else_block`
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Seiichi Uchida [Thu, 11 Oct 2018 08:36:39 +0000 (17:36 +0900)]
Merge pull request #3087 from scampi/lineoverflow
fixed display message for the LineOverflow error
Stéphane Campinas [Thu, 11 Oct 2018 07:05:33 +0000 (09:05 +0200)]
fixed display message for the LineOverflow error
Otavio Salvador [Thu, 11 Oct 2018 00:53:25 +0000 (21:53 -0300)]
Update rustc-ap-* to 272.0.0
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>