]>
git.lizzy.rs Git - rust.git/log
Nick Cameron [Fri, 9 Nov 2018 02:26:05 +0000 (15:26 +1300)]
Merge pull request #3188 from scampi/issue3124
do not add a newline after a missed span if it is the end of a block comment
Nick Cameron [Fri, 9 Nov 2018 02:14:44 +0000 (15:14 +1300)]
Merge pull request #3183 from scampi/issue3182
do not wrap comments in doctest to avoid failing doctest runs
Stéphane Campinas [Thu, 8 Nov 2018 21:44:59 +0000 (22:44 +0100)]
do not add a newline after a missed span if it is the end of a block comment
Seiichi Uchida [Thu, 8 Nov 2018 14:16:13 +0000 (23:16 +0900)]
Cargo update (#3186)
Update `rustc-ap-*` crates to 290.0.0.
Alan Du [Thu, 8 Nov 2018 05:28:08 +0000 (00:28 -0500)]
Do not count /*/ as both start and end comment (#3185)
Seiichi Uchida [Thu, 8 Nov 2018 05:15:09 +0000 (14:15 +0900)]
Merge pull request #3181 from scampi/issue3131
fix the logic for retaining a comment before the arrow in a match
Nick Cameron [Wed, 7 Nov 2018 20:24:46 +0000 (09:24 +1300)]
0.99.7
Stéphane Campinas [Wed, 7 Nov 2018 15:48:39 +0000 (16:48 +0100)]
do not wrap comments in doctest to avoid failing doctest runs
Stéphane Campinas [Wed, 7 Nov 2018 14:00:33 +0000 (15:00 +0100)]
fix the logic for retaining a comment before the arrow in a match
Kevin Stenerson [Wed, 7 Nov 2018 08:49:53 +0000 (01:49 -0700)]
Trim the indentation on macros which heuristically appear to use block-style indentation (#3178)
Nick Cameron [Mon, 5 Nov 2018 21:23:30 +0000 (10:23 +1300)]
Merge pull request #3172 from scampi/issue3153
trim the start of a line when wrapping an item in preparation for formatting
Nick Cameron [Mon, 5 Nov 2018 21:12:35 +0000 (10:12 +1300)]
Merge pull request #3171 from lqd/whitespace_jam
normalize_doc_attributes: remove whitespace from the doc comment opener
Stéphane Campinas [Mon, 5 Nov 2018 19:22:06 +0000 (20:22 +0100)]
trim the start of a line when wrapping an item in preparation for formatting
Rémy Rakic [Mon, 5 Nov 2018 17:24:36 +0000 (18:24 +0100)]
normalize_doc_attributes: remove leading whitespace from the doc comment opener
Remove possible whitespace from the `CommentStyle::opener()` so that the literal itself has control over the comment's leading spaces.
This is most useful for tools, such as bindgen, to allow for example: machine-readable comments with precise syntax rules, or idempotently round-tripping between the proc-macro API and rustfmt.
Nick Cameron [Sun, 4 Nov 2018 23:59:54 +0000 (12:59 +1300)]
Merge pull request #3165 from scampi/alignment
fix alignment of a struct's fields with the visual style
Stéphane Campinas [Sun, 4 Nov 2018 09:51:38 +0000 (10:51 +0100)]
fix alignment of a struct's fields with the visual style
- rewrite_with_alignment was called from the expr module with the wrong
shape that missed the extra offset needed for the visual style
- rewrite_with_alignment was indenting the given shape although that
should have been the caller's responsability
Nick Cameron [Thu, 1 Nov 2018 21:08:39 +0000 (10:08 +1300)]
Merge pull request #3145 from otavio/allow-failure-for-crater
CI: only run unit tests for `crater`
Otavio Salvador [Thu, 1 Nov 2018 20:56:54 +0000 (17:56 -0300)]
Travis CI: Move `futures-rs` out from allow-failures
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Otavio Salvador [Sun, 28 Oct 2018 01:05:46 +0000 (22:05 -0300)]
CI: Rework integration script so only lib unit tests are run for crater
Refs: https://github.com/rust-lang-nursery/crater/issues/358
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Nick Cameron [Wed, 31 Oct 2018 01:33:11 +0000 (14:33 +1300)]
Merge pull request #3159 from scampi/issue-3132
The method trim_left_preserve_layout didn't handle tabs properly.
Nick Cameron [Wed, 31 Oct 2018 00:31:24 +0000 (13:31 +1300)]
Merge pull request #3152 from topecongiro/do-not-override-edition-in-rustfmt-toml
Use edition in rustfmt.toml when no command line argument is passed
Stéphane Campinas [Tue, 30 Oct 2018 00:09:09 +0000 (01:09 +0100)]
The method trim_left_preserve_layout didn't handle tabs properly.
This is fixed by taking the method macros::indent_macro_snippet which
essentially does the same: it indents a paragraph while preserving the
layout.
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