]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoMerge pull request #3069 from topecongiro/issue-3003
Nick Cameron [Mon, 8 Oct 2018 00:04:45 +0000 (13:04 +1300)]
Merge pull request #3069 from topecongiro/issue-3003

Consider a multi-lined array as a block-like expression

5 years agoMerge pull request #3067 from topecongiro/refactor-toexpr
Nick Cameron [Sun, 7 Oct 2018 23:38:33 +0000 (12:38 +1300)]
Merge pull request #3067 from topecongiro/refactor-toexpr

Add println!-like heuristic to the fail attribute

5 years agoMerge pull request #3063 from otavio/add-doc-is_doc_comment
Nick Cameron [Sun, 7 Oct 2018 21:41:18 +0000 (10:41 +1300)]
Merge pull request #3063 from otavio/add-doc-is_doc_comment

comment: Add documentation to `is_doc_comment` public method

5 years agoMerge pull request #3079 from topecongiro/rustc-ap
Seiichi Uchida [Sat, 6 Oct 2018 22:37:44 +0000 (07:37 +0900)]
Merge pull request #3079 from topecongiro/rustc-ap

Cargo update

5 years agoFix empty types being inserted to closure
Seiichi Uchida [Sat, 6 Oct 2018 15:52:06 +0000 (00:52 +0900)]
Fix empty types being inserted to closure

cc https://github.com/rust-lang/rust/pull/54229.

5 years agoCargo update
Seiichi Uchida [Sat, 6 Oct 2018 15:39:49 +0000 (00:39 +0900)]
Cargo update

5 years agoMerge pull request #3073 from scampi/format_strings
Seiichi Uchida [Tue, 2 Oct 2018 01:29:37 +0000 (10:29 +0900)]
Merge pull request #3073 from scampi/format_strings

format_strings: take into account newline occurring within a rewritten line

5 years agoformat_strings: take into account newline occurring within a rewritten line
Stéphane Campinas [Mon, 1 Oct 2018 22:41:56 +0000 (00:41 +0200)]
format_strings: take into account newline occurring within a rewritten line

5 years agoConsider a multi-lined array as a block-like expression
Seiichi Uchida [Sun, 30 Sep 2018 14:27:27 +0000 (23:27 +0900)]
Consider a multi-lined array as a block-like expression

5 years agoAdd a test for #3003
Seiichi Uchida [Sun, 30 Sep 2018 14:27:03 +0000 (23:27 +0900)]
Add a test for #3003

and run cargo fmt.

5 years agoUpdate .travis.yml
Seiichi Uchida [Sun, 30 Sep 2018 00:10:52 +0000 (09:10 +0900)]
Update .travis.yml

5 years agoFormat and update test
Seiichi Uchida [Sat, 29 Sep 2018 23:04:34 +0000 (08:04 +0900)]
Format and update test

5 years agoPut arguments of the fail attribute on the same line as println!
Seiichi Uchida [Sat, 29 Sep 2018 23:03:26 +0000 (08:03 +0900)]
Put arguments of the fail attribute on the same line as println!

5 years agoMove maybe_get_args_offset to overflow.rs
Seiichi Uchida [Sat, 29 Sep 2018 23:02:55 +0000 (08:02 +0900)]
Move maybe_get_args_offset to overflow.rs

5 years agoAvoid using to_expr as much as possible
Seiichi Uchida [Sat, 29 Sep 2018 22:10:31 +0000 (07:10 +0900)]
Avoid using to_expr as much as possible

5 years agoGet rid of ToExpr trait
Seiichi Uchida [Sat, 29 Sep 2018 15:26:36 +0000 (00:26 +0900)]
Get rid of ToExpr trait

5 years agoTake impl Iterator for overflow routines
Seiichi Uchida [Sat, 29 Sep 2018 05:33:00 +0000 (14:33 +0900)]
Take impl Iterator for overflow routines

5 years agocomment: Add documentation to `is_doc_comment` public method
Otavio Salvador [Thu, 27 Sep 2018 19:45:22 +0000 (16:45 -0300)]
comment: Add documentation to `is_doc_comment` public method

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
5 years agoMerge pull request #3061 from mehcode/feature/default-edition
Nick Cameron [Fri, 28 Sep 2018 09:54:29 +0000 (21:54 +1200)]
Merge pull request #3061 from mehcode/feature/default-edition

Fix help message for edition config option

5 years agoMerge pull request #2816 from moxian/enum-discrim
Nick Cameron [Fri, 28 Sep 2018 09:48:57 +0000 (21:48 +1200)]
Merge pull request #2816 from moxian/enum-discrim

Add option to vertically align enum discriminants.

5 years agoFix help message for edition config option
Ryan Leckey [Fri, 28 Sep 2018 05:31:17 +0000 (22:31 -0700)]
Fix help message for edition config option

5 years agoMerge pull request #3050 from andrehjr/empty-impl-body-with-braces-newline
Seiichi Uchida [Fri, 28 Sep 2018 02:10:58 +0000 (11:10 +0900)]
Merge pull request #3050 from andrehjr/empty-impl-body-with-braces-newline

Trait Implementation - Adds a newline before the last brace on impls without a body if the first brace is also on a newline

5 years agoMerge pull request #3052 from scampi/contributing
Seiichi Uchida [Fri, 28 Sep 2018 02:08:51 +0000 (11:08 +0900)]
Merge pull request #3052 from scampi/contributing

added a note about the use of the RUST_LOG environment variable

5 years agodo not format a code block in documentation if it is annotated with ignore or text...
Stéphane Campinas [Fri, 28 Sep 2018 02:06:29 +0000 (04:06 +0200)]
do not format a code block in documentation if it is annotated with ignore or text (#3058)

5 years agoadded a note about the use of the RUST_LOG environment variable
Stéphane Campinas [Wed, 26 Sep 2018 20:41:31 +0000 (22:41 +0200)]
added a note about the use of the RUST_LOG environment variable

5 years agoChange enum align semantics to care about absolute length, rather than difference.
moxian [Wed, 26 Sep 2018 18:29:26 +0000 (18:29 +0000)]
Change enum align semantics to care about absolute length, rather than difference.

If we're only aligning enum discriminants that are "not too far apart
(length-wise)", then this works really well for enums with
consistently-long or consistently-short idents, but not for the mixed
ones.
However, consistently-long idents is somewhate of an uncommon case and
overlong idents may be allowed to be formatted suboptimally if that
makes mixed-length idents work better (and it does in this case).

5 years agoAdd option to vertically align enum discriminants.
moxian [Fri, 29 Jun 2018 06:47:51 +0000 (06:47 +0000)]
Add option to vertically align enum discriminants.

5 years agoMakes brace behavior consistent with empty bodies for traits and impls
André Luis Leal Cardoso Junior [Tue, 25 Sep 2018 11:53:42 +0000 (08:53 -0300)]
Makes brace behavior consistent with empty bodies for traits and impls

Adds a newline before the last brace on impls without a body if the first brace is also on a newline

5 years agoUpdate rustc_ap_syntax
Nick Cameron [Tue, 25 Sep 2018 20:55:15 +0000 (08:55 +1200)]
Update rustc_ap_syntax

5 years agoRemove unnecessary feature flag
Nick Cameron [Tue, 25 Sep 2018 06:23:17 +0000 (18:23 +1200)]
Remove unnecessary feature flag

5 years agoMerge pull request #3048 from emilio/merged-comments
Nick Cameron [Mon, 24 Sep 2018 02:22:01 +0000 (14:22 +1200)]
Merge pull request #3048 from emilio/merged-comments

lists: Detect block comment by starting from the end.

5 years agoMerge pull request #3045 from scampi/issue2917
Nick Cameron [Mon, 24 Sep 2018 02:11:46 +0000 (14:11 +1200)]
Merge pull request #3045 from scampi/issue2917

Prevent right-shifting of block comments with bare lines.

5 years agoMerge pull request #3044 from orium/fix-too-many-modsep
Nick Cameron [Mon, 24 Sep 2018 02:07:20 +0000 (14:07 +1200)]
Merge pull request #3044 from orium/fix-too-many-modsep

Fix bug in import where two consecutive module separators were possible.

5 years agolists: Detect block comment by starting from the end.
Emilio Cobos Álvarez [Sat, 22 Sep 2018 10:03:33 +0000 (12:03 +0200)]
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

5 years agoPrevent right-shifting of block comments with bare lines.
Stéphane Campinas [Fri, 21 Sep 2018 22:09:11 +0000 (00:09 +0200)]
Prevent right-shifting of block comments with bare lines.

Lines that didn't start with a comment sigil were returned unchanged in
comment::rewrite_comment. Then these unchanged lines were indented in
MacroBranch::rewrite.

5 years agoFix bug in import where two consecutive module separators were possible.
Diogo Sousa [Fri, 21 Sep 2018 17:46:35 +0000 (18:46 +0100)]
Fix bug in import where two consecutive module separators were possible.

Fixes #3043.

5 years agoMerge pull request #3042 from topecongiro/issue-3040
Nick Cameron [Fri, 21 Sep 2018 02:25:21 +0000 (14:25 +1200)]
Merge pull request #3042 from topecongiro/issue-3040

Do not trim a block from expression if its condition will go multi-line

5 years agoDo not trim a block from expression if its condition will go multi-line
Seiichi Uchida [Thu, 20 Sep 2018 15:58:47 +0000 (00:58 +0900)]
Do not trim a block from expression if its condition will go multi-line

5 years agoAdd a test for #3040
Seiichi Uchida [Thu, 20 Sep 2018 15:57:46 +0000 (00:57 +0900)]
Add a test for #3040

5 years agoMerge pull request #3036 from topecongiro/issue-2932
Nick Cameron [Wed, 19 Sep 2018 23:36:46 +0000 (11:36 +1200)]
Merge pull request #3036 from topecongiro/issue-2932

Combine chain items only when the item gets orphaned otherwise

5 years agoMerge pull request #3035 from topecongiro/issue-3006
Nick Cameron [Wed, 19 Sep 2018 23:33:47 +0000 (11:33 +1200)]
Merge pull request #3035 from topecongiro/issue-3006

Format generics on associated types

5 years agoCargo fmt
Seiichi Uchida [Wed, 19 Sep 2018 14:22:26 +0000 (23:22 +0900)]
Cargo fmt

5 years agoFix shape for index
Seiichi Uchida [Wed, 19 Sep 2018 14:21:07 +0000 (23:21 +0900)]
Fix shape for index

5 years agoCombine chain items only when the item will get orphaned
Seiichi Uchida [Wed, 19 Sep 2018 14:20:43 +0000 (23:20 +0900)]
Combine chain items only when the item will get orphaned

5 years agoUpdate tests
Seiichi Uchida [Wed, 19 Sep 2018 14:19:24 +0000 (23:19 +0900)]
Update tests

5 years agoFormat generics on associated types
Seiichi Uchida [Wed, 19 Sep 2018 13:33:10 +0000 (22:33 +0900)]
Format generics on associated types

5 years agoAdd a test for #3006
Seiichi Uchida [Wed, 19 Sep 2018 13:20:42 +0000 (22:20 +0900)]
Add a test for #3006

5 years agoMerge pull request #3028 from scampi/issue2973
Nick Cameron [Tue, 18 Sep 2018 23:31:28 +0000 (11:31 +1200)]
Merge pull request #3028 from scampi/issue2973

Fix indent computation of a macro with braces.

5 years agoMerge pull request #3002 from lqd/normalize-doc-attributes
Nick Cameron [Tue, 18 Sep 2018 23:05:27 +0000 (11:05 +1200)]
Merge pull request #3002 from lqd/normalize-doc-attributes

normalize_doc_attributes option: convert doc attributes to comments

5 years agoMerge pull request #3001 from scampi/issue2977
Nick Cameron [Tue, 18 Sep 2018 22:43:21 +0000 (10:43 +1200)]
Merge pull request #3001 from scampi/issue2977

propagate errors about failing to rewrite a macro

5 years agoMerge pull request #3014 from PSeitz/master
Nick Cameron [Tue, 18 Sep 2018 22:42:16 +0000 (10:42 +1200)]
Merge pull request #3014 from PSeitz/master

fixes #2914 by handling BadIssue case

5 years agoMerge pull request #3013 from YaLTeR/fix-issue-2985
Seiichi Uchida [Tue, 18 Sep 2018 11:21:21 +0000 (20:21 +0900)]
Merge pull request #3013 from YaLTeR/fix-issue-2985

Fix wrong shape for last chain items for indent_style = "Visual"

5 years agoImprove error message when failing cargo metadata (#3024)
Nathan Sutton [Tue, 18 Sep 2018 11:20:07 +0000 (06:20 -0500)]
Improve error message when failing cargo metadata (#3024)

5 years agoMerge pull request #3019 from yangby-cryptape/fix-typo-in-readme
Seiichi Uchida [Tue, 18 Sep 2018 11:18:24 +0000 (20:18 +0900)]
Merge pull request #3019 from yangby-cryptape/fix-typo-in-readme

Fix typo in README.md.

5 years agoMerge pull request #3017 from matthiaskrgr/typo
Seiichi Uchida [Tue, 18 Sep 2018 11:17:59 +0000 (20:17 +0900)]
Merge pull request #3017 from matthiaskrgr/typo

cargo fmt: fix typo in format_crate(): (verison -> version)

5 years agoMerge pull request #3012 from YaLTeR/fix-issue-2496
Nick Cameron [Tue, 18 Sep 2018 09:12:12 +0000 (21:12 +1200)]
Merge pull request #3012 from YaLTeR/fix-issue-2496

Fix match arm block flattening

5 years agoFix indent computation of a macro with braces.
Stéphane Campinas [Mon, 17 Sep 2018 21:17:36 +0000 (23:17 +0200)]
Fix indent computation of a macro with braces.

The leading whitespace of a multine string was taken into account when
computing the `min_prefix_space_width`, even if that line couldn't be
trimmed. The consequence is it was always shifting the macro's content
to the right.

5 years agoFix typo in README.md.
Boyu Yang [Thu, 13 Sep 2018 02:01:34 +0000 (10:01 +0800)]
Fix typo in README.md.

5 years agoadd test ensuring only doc = "" attributes are normalized to comments
Rémy Rakic [Thu, 13 Sep 2018 00:40:24 +0000 (02:40 +0200)]
add test ensuring only doc = "" attributes are normalized to comments

The other shapes of doc attributes shouldn't be normalized or modified.

5 years agoadd tests interleaving doc attrib comments and regular comments
Rémy Rakic [Thu, 13 Sep 2018 00:27:09 +0000 (02:27 +0200)]
add tests interleaving doc attrib comments and regular comments

5 years agoaddress review comment in Attribute rewrite fn
Rémy Rakic [Wed, 12 Sep 2018 23:13:07 +0000 (01:13 +0200)]
address review comment in Attribute rewrite fn

5 years agoadd non-regression test to existing attributes
Rémy Rakic [Wed, 12 Sep 2018 23:10:57 +0000 (01:10 +0200)]
add non-regression test to existing attributes

when `normalize_doc_attributes` is on, they shouldn't be affected

5 years agoadd non-regression test to existing doc attributes
Rémy Rakic [Wed, 12 Sep 2018 23:06:02 +0000 (01:06 +0200)]
add non-regression test to existing doc attributes

when `normalize_doc_attributes` is off, they shouldn't be normalized to a doc comment

5 years agoadd test with multiple levels of indents
Rémy Rakic [Wed, 12 Sep 2018 23:02:11 +0000 (01:02 +0200)]
add test with multiple levels of indents

5 years agomove config attribute
Rémy Rakic [Wed, 12 Sep 2018 22:37:31 +0000 (00:37 +0200)]
move config attribute

5 years agocargo fmt: fix typo in format_crate(): (verison -> version)
Matthias Krüger [Wed, 12 Sep 2018 19:43:31 +0000 (21:43 +0200)]
cargo fmt: fix typo in format_crate(): (verison -> version)

5 years agoimplement Drop from FmtVisitor in order to simplify failures passing
Stéphane Campinas [Wed, 12 Sep 2018 11:09:07 +0000 (13:09 +0200)]
implement Drop from FmtVisitor in order to simplify failures passing

5 years agoMerge pull request #3000 from dimbleby/dch/typo
Nick Cameron [Wed, 12 Sep 2018 03:33:18 +0000 (15:33 +1200)]
Merge pull request #3000 from dimbleby/dch/typo

Fix typo in usage text

5 years agoMerge pull request #2998 from ReapOmen/fix-rustfmt-diff-output
Nick Cameron [Wed, 12 Sep 2018 03:32:27 +0000 (15:32 +1200)]
Merge pull request #2998 from ReapOmen/fix-rustfmt-diff-output

Change `print_diff` to output the correct line number.

5 years agoMerge pull request #3010 from topecongiro/issue-3009
Nick Cameron [Wed, 12 Sep 2018 01:55:41 +0000 (13:55 +1200)]
Merge pull request #3010 from topecongiro/issue-3009

Refactor the corner case of handling long function

5 years agoMerge pull request #3011 from topecongiro/rustc-ap-syntax
Nick Cameron [Wed, 12 Sep 2018 01:55:06 +0000 (13:55 +1200)]
Merge pull request #3011 from topecongiro/rustc-ap-syntax

Cargo update

5 years agoMerge pull request #3015 from YaLTeR/fix-fn-type-comma
Nick Cameron [Wed, 12 Sep 2018 01:54:23 +0000 (13:54 +1200)]
Merge pull request #3015 from YaLTeR/fix-fn-type-comma

Fix extra new line in fn type aliases with indent_style = "Visual"

5 years agoDon't insert a new line when fn has no return type
Ivan Molodetskikh [Tue, 11 Sep 2018 09:34:33 +0000 (12:34 +0300)]
Don't insert a new line when fn has no return type

5 years agoAdd a visual fn type alias test
Ivan Molodetskikh [Tue, 11 Sep 2018 09:34:21 +0000 (12:34 +0300)]
Add a visual fn type alias test

5 years agofixes #2914 by handling BadIssue case
Pascal Seitz [Tue, 11 Sep 2018 08:46:39 +0000 (10:46 +0200)]
fixes #2914 by handling BadIssue case

5 years agoFix last chain item shape for Visual indent_style
Ivan Molodetskikh [Tue, 11 Sep 2018 08:08:28 +0000 (11:08 +0300)]
Fix last chain item shape for Visual indent_style

5 years agoAdd a test for #2985
Ivan Molodetskikh [Tue, 11 Sep 2018 08:09:17 +0000 (11:09 +0300)]
Add a test for #2985

5 years agoUse correct heuristic for match block flattening
Ivan Molodetskikh [Tue, 11 Sep 2018 05:41:16 +0000 (08:41 +0300)]
Use correct heuristic for match block flattening

5 years agoAdd a test for match flattening
Ivan Molodetskikh [Tue, 11 Sep 2018 05:31:35 +0000 (08:31 +0300)]
Add a test for match flattening

5 years agoAdd a test for #2496
Ivan Molodetskikh [Fri, 31 Aug 2018 14:51:36 +0000 (17:51 +0300)]
Add a test for #2496

5 years agoCargo update
Seiichi Uchida [Tue, 11 Sep 2018 04:52:46 +0000 (13:52 +0900)]
Cargo update

5 years agoRefactor the corner case of handling long function
Seiichi Uchida [Tue, 11 Sep 2018 04:31:37 +0000 (13:31 +0900)]
Refactor the corner case of handling long function

5 years agoAdd a test for #3009
Seiichi Uchida [Tue, 11 Sep 2018 04:30:36 +0000 (13:30 +0900)]
Add a test for #3009

5 years agoMerge pull request #2988 from YaLTeR/fix-issue-2922
Nick Cameron [Tue, 11 Sep 2018 03:50:13 +0000 (15:50 +1200)]
Merge pull request #2988 from YaLTeR/fix-issue-2922

Use correct indent in rewrite_bare_fn with Visual style

5 years agoMerge pull request #3007 from alexcrichton/wasm
Nick Cameron [Sun, 9 Sep 2018 21:50:49 +0000 (09:50 +1200)]
Merge pull request #3007 from alexcrichton/wasm

Support platforms without a timer

5 years agoSupport platforms without a timer
Alex Crichton [Sun, 9 Sep 2018 18:12:13 +0000 (11:12 -0700)]
Support platforms without a timer

I've dabbled recently in seeing how hard it would be to compile rustfmt to wasm
and then run it in a web browser, and it turns out that it's [not too
hard][wasm]! In addition to patching a few dependencies which already have a
number of patches out rustfmt also needed some modifications to get it to work,
namely avoiding the usage of `Instant::now()` on the "happy path" which doesn't
work on wasm (it just panics).

This commit is an attempt to add a support for this by avoiding using
`Instant::now()` on the wasm target, but panicking if the actual time elapsed is
requested (which doesn't happen unless verbosely logging I believe).

[wasm]: https://alexcrichton.github.io/rustfmt-wasm/

5 years agonormalize_doc_attributes option: convert doc attributes to comments
lqd [Fri, 7 Sep 2018 17:51:21 +0000 (19:51 +0200)]
normalize_doc_attributes option: convert doc attributes to comments

Convert `#![doc]` and `#[doc]` attributes to `//!` and `///` doc comments.

5 years agopropagate errors about failing to rewrite a macro
Stéphane Campinas [Fri, 7 Sep 2018 12:48:52 +0000 (14:48 +0200)]
propagate errors about failing to rewrite a macro

5 years agoFix typo in usage text
David Hotham [Fri, 7 Sep 2018 08:01:44 +0000 (09:01 +0100)]
Fix typo in usage text

5 years agoChange `print_diff` to output the correct line number.
Robert Bartlensky [Thu, 6 Sep 2018 16:16:48 +0000 (17:16 +0100)]
Change `print_diff` to output the correct line number.

5 years agoMerge pull request #2997 from matthiaskrgr/cargo_test_release
Nick Cameron [Thu, 6 Sep 2018 05:40:08 +0000 (17:40 +1200)]
Merge pull request #2997 from matthiaskrgr/cargo_test_release

fix cargo test --release

5 years agofix cargo test --release.
Matthias Krüger [Thu, 6 Sep 2018 00:07:09 +0000 (02:07 +0200)]
fix cargo test --release.

test::verify_check_works was failing in relase mode on my machine.

The problem was it would check for target/debug/rustfmt in release mode instead of
target/release/rustfmt and fail an assert.

This commit fixes it so that cargo check looks for target/debug/rustfmt and
cargo check --release looks for target/release/rustfmt

5 years agoMerge pull request #2983 from topecongiro/issue-2642
Nick Cameron [Tue, 4 Sep 2018 07:11:49 +0000 (19:11 +1200)]
Merge pull request #2983 from topecongiro/issue-2642

Handle raw string literals in CharClasses

5 years agoMerge pull request #2993 from topecongiro/rustc-ap
Nick Cameron [Tue, 4 Sep 2018 07:11:23 +0000 (19:11 +1200)]
Merge pull request #2993 from topecongiro/rustc-ap

Cargo update

5 years agoCargo update
topecongiro [Fri, 31 Aug 2018 05:21:02 +0000 (14:21 +0900)]
Cargo update

5 years agoMerge pull request #2992 from max-sixty/clippy2
Nick Cameron [Mon, 3 Sep 2018 01:25:35 +0000 (13:25 +1200)]
Merge pull request #2992 from max-sixty/clippy2

Clippy 2/2

5 years agoMerge pull request #2986 from topecongiro/issue-2907
Nick Cameron [Mon, 3 Sep 2018 01:10:50 +0000 (13:10 +1200)]
Merge pull request #2986 from topecongiro/issue-2907

Handle chain w/ try operators with spaces

5 years agoMerge pull request #2991 from topecongiro/raw-identifier-in-chain
Nick Cameron [Mon, 3 Sep 2018 01:08:19 +0000 (13:08 +1200)]
Merge pull request #2991 from topecongiro/raw-identifier-in-chain

Handle raw identifiers in chain

5 years agofinal clippy changes
Maximilian Roos [Sat, 1 Sep 2018 20:26:47 +0000 (16:26 -0400)]
final clippy changes

5 years agoHandle raw identifiers in chain
Seiichi Uchida [Sat, 1 Sep 2018 07:18:27 +0000 (16:18 +0900)]
Handle raw identifiers in chain