]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoSimplify UseTree::has_comment
Seiichi Uchida [Fri, 6 Apr 2018 14:03:11 +0000 (23:03 +0900)]
Simplify UseTree::has_comment

6 years agoMerge imports with the same prefix into a single nested import
Seiichi Uchida [Fri, 6 Apr 2018 13:35:04 +0000 (22:35 +0900)]
Merge imports with the same prefix into a single nested import

6 years agoAdd merge_imports config option
Seiichi Uchida [Fri, 6 Apr 2018 13:34:41 +0000 (22:34 +0900)]
Add merge_imports config option

6 years agoAdd tests for merge_imports config option
Seiichi Uchida [Fri, 6 Apr 2018 13:32:30 +0000 (22:32 +0900)]
Add tests for merge_imports config option

6 years agoMerge pull request #2612 from peterhuene/suppress-unstable-config-options
Nick Cameron [Tue, 10 Apr 2018 03:07:57 +0000 (15:07 +1200)]
Merge pull request #2612 from peterhuene/suppress-unstable-config-options

Suppress unstable config options by default.

6 years agoMerge pull request #2613 from dwijnand/patch-1
Nick Cameron [Tue, 10 Apr 2018 02:15:26 +0000 (14:15 +1200)]
Merge pull request #2613 from dwijnand/patch-1

specify nightly required to install from source

6 years agospecify nightly required to install from source
Dale Wijnand [Mon, 9 Apr 2018 21:54:17 +0000 (22:54 +0100)]
specify nightly required to install from source

when using stable cargo install fails due to #![feature] usage:

    error[E0554]: #![feature] may not be used on the stable release channel
      --> /Users/dnw/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-serialize-67.0.0/lib.rs:24:1
       |
    24 | #![feature(rustc_private, box_syntax)]
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    error[E0554]: #![feature] may not be used on the stable release channel
      --> /Users/dnw/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-serialize-67.0.0/lib.rs:25:1
       |
    25 | #![feature(core_intrinsics)]
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    error[E0554]: #![feature] may not be used on the stable release channel
      --> /Users/dnw/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-serialize-67.0.0/lib.rs:26:1
       |
    26 | #![feature(i128_type)]
       | ^^^^^^^^^^^^^^^^^^^^^^

    error[E0554]: #![feature] may not be used on the stable release channel
      --> /Users/dnw/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-serialize-67.0.0/lib.rs:27:1
       |
    27 | #![feature(specialization)]
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

    error: aborting due to 4 previous errors

    error: Could not compile `rustc-ap-serialize`.
    warning: build failed, waiting for other jobs to finish...
    error: failed to compile `rustfmt-nightly v0.4.1 (file:///d/rustfmt)`, intermediate artifacts can be found at `/d/rustfmt/target`

6 years agoSuppress unstable config options by default.
Peter Huene [Mon, 9 Apr 2018 07:43:17 +0000 (00:43 -0700)]
Suppress unstable config options by default.

This commit suppresses the output of unstable config options by default.

Users can specify the `--unstable-features` option to show the config options
that are unstable.

Fixes #2611.

6 years agoTry to fix a build regression before it happens
Nick Cameron [Mon, 9 Apr 2018 09:07:49 +0000 (21:07 +1200)]
Try to fix a build regression before it happens

6 years agoMake `error_on_line_overflow` false by default
Nick Cameron [Mon, 9 Apr 2018 04:47:55 +0000 (16:47 +1200)]
Make `error_on_line_overflow` false by default

And improve docs, the error message, etc.

I think false is the better default since such errors should only occur due to a bug in Rustfmt and therefore most users should not be notified of it happening (although to be clear, it might be a 'bug' which only occurs with pathological input and therefore we won't fix it). The error has proven to be confusing and annoying in the past.

Closes #1080

6 years agoReorder config options
Nick Cameron [Mon, 9 Apr 2018 04:31:53 +0000 (16:31 +1200)]
Reorder config options

cc #1974

6 years agoFix test
Nick Cameron [Sun, 8 Apr 2018 21:54:07 +0000 (09:54 +1200)]
Fix test

6 years agoMerge pull request #2609 from csmoe/update_rustc_syntax
Nick Cameron [Sun, 8 Apr 2018 21:49:39 +0000 (09:49 +1200)]
Merge pull request #2609 from csmoe/update_rustc_syntax

update rustc_ap_syntax

6 years agoupdate rustc syntax 91.0.0
csmoe [Sun, 8 Apr 2018 14:18:18 +0000 (22:18 +0800)]
update rustc syntax 91.0.0

6 years agoCargo update (#2602)
Seiichi Uchida [Fri, 6 Apr 2018 14:09:45 +0000 (23:09 +0900)]
Cargo update (#2602)

Update `rustc-ap-syntax` to 89.0.0 and fix up breaking changes.

6 years agoMerge pull request #2601 from topecongiro/fix-merge-mess
Nick Cameron [Fri, 6 Apr 2018 03:32:05 +0000 (15:32 +1200)]
Merge pull request #2601 from topecongiro/fix-merge-mess

Fix up merge mess

6 years agoFix up merge mess
Seiichi Uchida [Fri, 6 Apr 2018 01:31:57 +0000 (10:31 +0900)]
Fix up merge mess

6 years agoMerge pull request #2600 from i1skn/error_on_unformatted
Nick Cameron [Fri, 6 Apr 2018 00:41:13 +0000 (12:41 +1200)]
Merge pull request #2600 from i1skn/error_on_unformatted

Fix error_on_unformatted and skip_children override

6 years agoMerge pull request #2599 from topecongiro/issue-2596
Nick Cameron [Thu, 5 Apr 2018 23:12:53 +0000 (11:12 +1200)]
Merge pull request #2599 from topecongiro/issue-2596

Use multiple lines for imports list which exceeds max width

6 years agoMerge pull request #2593 from topecongiro/issue-2455
Nick Cameron [Thu, 5 Apr 2018 23:12:11 +0000 (11:12 +1200)]
Merge pull request #2593 from topecongiro/issue-2455

Add reorder_impl_items config option

6 years agoFix error_on_unformatted and skip_children override
Ivan Sorokin [Sat, 31 Mar 2018 12:27:39 +0000 (14:27 +0200)]
Fix error_on_unformatted and skip_children override

Currently, error_on_unformatted and skip_children options
specified in the config file are discarded.
This happens because CLI options have a higher priority,
but we coerce an absence of a `bool` option to `false`.
In this scenario, an absence of a `bool` option is indistinguishable
from explicetely set as `false`. We should coerce it to `None` instead,
so it does not override the one in the config file.

6 years agoMerge pull request #2576 from topecongiro/merge-imports
Nick Cameron [Thu, 5 Apr 2018 05:39:22 +0000 (17:39 +1200)]
Merge pull request #2576 from topecongiro/merge-imports

Use normalized form to format use items

6 years agoMerge pull request #2589 from topecongiro/issue-2588
Nick Cameron [Thu, 5 Apr 2018 05:36:15 +0000 (17:36 +1200)]
Merge pull request #2589 from topecongiro/issue-2588

Do not indent or unindent inside string literal

6 years agoMerge pull request #2581 from sinkuu/build_script
Nick Cameron [Thu, 5 Apr 2018 05:35:52 +0000 (17:35 +1200)]
Merge pull request #2581 from sinkuu/build_script

Rerun build.rs only when .git/HEAD or CFG_RELEASE_CHANNEL is changed

6 years agoMerge pull request #2580 from remram44/improve-where_single_line-help
Nick Cameron [Thu, 5 Apr 2018 05:34:53 +0000 (17:34 +1200)]
Merge pull request #2580 from remram44/improve-where_single_line-help

Improve `where_single_line` help

6 years agoAdd trailing comma when using mixed layout with block indent
Seiichi Uchida [Thu, 5 Apr 2018 04:27:42 +0000 (13:27 +0900)]
Add trailing comma when using mixed layout with block indent

6 years agoPut imports list on the next line if it exceeds max width
Seiichi Uchida [Thu, 5 Apr 2018 04:24:18 +0000 (13:24 +0900)]
Put imports list on the next line if it exceeds max width

6 years agoAdd a test for #2569
Seiichi Uchida [Thu, 5 Apr 2018 04:23:48 +0000 (13:23 +0900)]
Add a test for #2569

6 years agoDo not indent or unindent inside string literal
Seiichi Uchida [Mon, 2 Apr 2018 14:10:37 +0000 (23:10 +0900)]
Do not indent or unindent inside string literal

Closes #2588.

6 years agoImplement LineClasses
Seiichi Uchida [Mon, 2 Apr 2018 13:53:16 +0000 (22:53 +0900)]
Implement LineClasses

6 years agoAdd tests for #2588
Seiichi Uchida [Mon, 2 Apr 2018 13:52:39 +0000 (22:52 +0900)]
Add tests for #2588

6 years agoReorder impl items based on its kind
Seiichi Uchida [Wed, 4 Apr 2018 05:57:55 +0000 (14:57 +0900)]
Reorder impl items based on its kind

The ordering is defined as follows:

type < cosnt < macro < method

Items that are same kind will not be reordered: that is, the item
that an user has put first comes first.

6 years agoAdd reorder_impl_items config option
Seiichi Uchida [Wed, 4 Apr 2018 05:57:30 +0000 (14:57 +0900)]
Add reorder_impl_items config option

6 years agotypo (#2598)
memoryleak47 [Thu, 5 Apr 2018 03:47:09 +0000 (05:47 +0200)]
typo (#2598)

* typo

* more typos

6 years agoadd tests for macro!(/* comment */) (#2592)
Ryan Leung [Wed, 4 Apr 2018 02:02:01 +0000 (10:02 +0800)]
add tests for macro!(/* comment */) (#2592)

* add tests

6 years agoInclude instructions to install on nightly (#2590)
Russell Cohen [Tue, 3 Apr 2018 02:10:50 +0000 (19:10 -0700)]
Include instructions to install on nightly (#2590)

6 years agoLet --dump-default-config default to stdout #2579 (#2586)
Marthog [Sun, 1 Apr 2018 14:15:25 +0000 (16:15 +0200)]
Let --dump-default-config default to stdout #2579 (#2586)

6 years agoMerge pull request #2584 from sinkuu/cleanup
Seiichi Uchida [Sun, 1 Apr 2018 14:14:52 +0000 (23:14 +0900)]
Merge pull request #2584 from sinkuu/cleanup

Misc cleanups

6 years agoDo not turn spaces in the beginning of the file into a newline (#2583)
Shotaro Yamada [Sun, 1 Apr 2018 14:09:53 +0000 (23:09 +0900)]
Do not turn spaces in the beginning of the file into a newline (#2583)

6 years agoFix typo
Shotaro Yamada [Sun, 1 Apr 2018 12:47:55 +0000 (21:47 +0900)]
Fix typo

6 years agoUse ListItem::has_comment
Shotaro Yamada [Sun, 1 Apr 2018 12:43:01 +0000 (21:43 +0900)]
Use ListItem::has_comment

6 years agoRemove redudant parens
Shotaro Yamada [Sun, 1 Apr 2018 12:35:51 +0000 (21:35 +0900)]
Remove redudant parens

6 years agoReturn String instead of always returing Cow::Owned
Shotaro Yamada [Sun, 1 Apr 2018 12:21:52 +0000 (21:21 +0900)]
Return String instead of always returing Cow::Owned

6 years agoRemove stray comment
Shotaro Yamada [Sun, 1 Apr 2018 12:10:31 +0000 (21:10 +0900)]
Remove stray comment

Its pointee was removed in 04a6d16c7b68587f8e9fa8a1e6715f80408b023b

6 years agoDo not collect into a Vec by hand
Shotaro Yamada [Sun, 1 Apr 2018 10:35:00 +0000 (19:35 +0900)]
Do not collect into a Vec by hand

6 years agoRemove unnecessary `[..]`s
Shotaro Yamada [Sun, 1 Apr 2018 09:12:50 +0000 (18:12 +0900)]
Remove unnecessary `[..]`s

6 years agoUse Iterator methods
Shotaro Yamada [Sun, 1 Apr 2018 09:43:52 +0000 (18:43 +0900)]
Use Iterator methods

6 years agoUse str::repeat
Shotaro Yamada [Sun, 1 Apr 2018 07:20:46 +0000 (16:20 +0900)]
Use str::repeat

6 years agoRerun build.rs only when .git/HEAD or CFG_RELEASE_CHANNEL is changed
Shotaro Yamada [Sun, 1 Apr 2018 07:45:23 +0000 (16:45 +0900)]
Rerun build.rs only when .git/HEAD or CFG_RELEASE_CHANNEL is changed

6 years agoImprove where_single_line help
Remi Rampin [Sat, 31 Mar 2018 22:51:41 +0000 (18:51 -0400)]
Improve where_single_line help

6 years agoAdd test #2574 (#2577)
Ivan Sorokin [Sat, 31 Mar 2018 15:54:44 +0000 (17:54 +0200)]
Add test #2574 (#2577)

6 years agoCargo fmt
Seiichi Uchida [Sat, 31 Mar 2018 05:47:50 +0000 (14:47 +0900)]
Cargo fmt

6 years agoCargo fmt
Seiichi Uchida [Sat, 31 Mar 2018 05:23:20 +0000 (14:23 +0900)]
Cargo fmt

6 years agoFormat normalized use item
Seiichi Uchida [Sat, 31 Mar 2018 04:21:13 +0000 (13:21 +0900)]
Format normalized use item

This commit implements `Rewrite` trait on `UseTree`, which is a normalized
form of `ast::UseTree` for rustfmt.

6 years agoDo not include separator to post comment
Seiichi Uchida [Sat, 31 Mar 2018 04:19:55 +0000 (13:19 +0900)]
Do not include separator to post comment

This prevents the trailing `;` on use item to be treated as comment.

6 years agoDo not insert newline when item is empty
Seiichi Uchida [Sat, 31 Mar 2018 04:18:53 +0000 (13:18 +0900)]
Do not insert newline when item is empty

This change is necessary when we remove unused imports (`use std::{};`).

6 years agoUpdate tests
Seiichi Uchida [Sat, 31 Mar 2018 04:16:36 +0000 (13:16 +0900)]
Update tests

1. snake_case < CamelCase < UPPER_SNAKE_CASE
2. Use vertical layout for list with nested imports.

6 years agoCargo update (#2575)
Seiichi Uchida [Fri, 30 Mar 2018 08:52:09 +0000 (17:52 +0900)]
Cargo update (#2575)

Update `rustc-ap-syntax` to 82.0.0.

6 years agoMerge pull request #2572 from codeworm96/remove_unreachable
Seiichi Uchida [Thu, 29 Mar 2018 00:16:38 +0000 (09:16 +0900)]
Merge pull request #2572 from codeworm96/remove_unreachable

Remove unreachable! from macros.rs

6 years agoAdd test for #2558
codeworm96 [Wed, 28 Mar 2018 15:50:21 +0000 (23:50 +0800)]
Add test for #2558

When run against invalid macro definitions, rustfmt should leave
them unchanged rather than panic.

6 years agoRemove unreachable! from macros.rs
codeworm96 [Wed, 28 Mar 2018 15:38:34 +0000 (23:38 +0800)]
Remove unreachable! from macros.rs

replaced unreachable! with error handling using Option.

Closes #2558

6 years agoMerge pull request #2571 from topecongiro/issue-2569
Nick Cameron [Wed, 28 Mar 2018 15:02:49 +0000 (17:02 +0200)]
Merge pull request #2571 from topecongiro/issue-2569

Avoid panicking on macro call with a single comma

6 years agoMerge pull request #2557 from topecongiro/vertical-layout-complex-attrs
Nick Cameron [Wed, 28 Mar 2018 15:01:16 +0000 (17:01 +0200)]
Merge pull request #2557 from topecongiro/vertical-layout-complex-attrs

Use vertical layout for complex attributes

6 years agoMerge pull request #2562 from topecongiro/issue-2196
Nick Cameron [Wed, 28 Mar 2018 14:49:25 +0000 (16:49 +0200)]
Merge pull request #2562 from topecongiro/issue-2196

Combine simple heuristics for function calls and array

6 years agoAvoid panicking on macro call with a single comma
Seiichi Uchida [Wed, 28 Mar 2018 09:14:51 +0000 (18:14 +0900)]
Avoid panicking on macro call with a single comma

`parse_item` from libsyntax may return `None`, so we need to discard
the result in that case.

6 years agoUpdate tests
Seiichi Uchida [Wed, 28 Mar 2018 08:41:58 +0000 (17:41 +0900)]
Update tests

6 years agoFollow indent style config when formatting attrs
Seiichi Uchida [Wed, 28 Mar 2018 07:56:39 +0000 (16:56 +0900)]
Follow indent style config when formatting attrs

6 years agoMerge pull request #2563 from rleungx/allow-underscore
Seiichi Uchida [Wed, 28 Mar 2018 03:41:51 +0000 (12:41 +0900)]
Merge pull request #2563 from rleungx/allow-underscore

allow underscore in macro_rules!

6 years agoallow underscore
rleungx [Mon, 26 Mar 2018 12:45:39 +0000 (20:45 +0800)]
allow underscore

6 years agoMerge pull request #2568 from mtn/features_typo
Seiichi Uchida [Tue, 27 Mar 2018 05:33:01 +0000 (14:33 +0900)]
Merge pull request #2568 from mtn/features_typo

/s/featuers/features

6 years ago/s/featuers/features
Michael Noronha [Tue, 27 Mar 2018 03:40:39 +0000 (22:40 -0500)]
/s/featuers/features

6 years agoMerge pull request #2567 from cramertj/master
Nick Cameron [Mon, 26 Mar 2018 21:07:34 +0000 (23:07 +0200)]
Merge pull request #2567 from cramertj/master

Allow stabilization of match_default_bindings

6 years agoAllow stabilization of match_default_bindings
Taylor Cramer [Mon, 26 Mar 2018 20:29:01 +0000 (22:29 +0200)]
Allow stabilization of match_default_bindings

6 years agoMerge pull request #2556 from topecongiro/issue-2554
Nick Cameron [Mon, 26 Mar 2018 05:01:24 +0000 (18:01 +1300)]
Merge pull request #2556 from topecongiro/issue-2554

Do not add the beginning vert to the match arm

6 years agoUpdate tests and cargo fmt
Seiichi Uchida [Sun, 25 Mar 2018 22:38:39 +0000 (07:38 +0900)]
Update tests and cargo fmt

6 years agoFormat array using overflow module
Seiichi Uchida [Sun, 25 Mar 2018 22:36:44 +0000 (07:36 +0900)]
Format array using overflow module

This commit applies heuristics used for function calls to array
and vice versa.

6 years agoFactor out default_tactic and fix indentation
Seiichi Uchida [Sun, 25 Mar 2018 22:34:17 +0000 (07:34 +0900)]
Factor out default_tactic and fix indentation

rustfmt fails to handle binary expressions with comments in-between.

6 years agoReplace MacroStyle with ast::DelimToken
Seiichi Uchida [Sun, 25 Mar 2018 22:32:48 +0000 (07:32 +0900)]
Replace MacroStyle with ast::DelimToken

6 years agoAvoid cloning RewriteContext
Seiichi Uchida [Sun, 25 Mar 2018 11:20:50 +0000 (20:20 +0900)]
Avoid cloning RewriteContext

6 years agoUse vertical layout for complex attributes
topecongiro [Sun, 25 Mar 2018 06:17:41 +0000 (15:17 +0900)]
Use vertical layout for complex attributes

6 years agoDo not add the beginning vert to the match arm
Seiichi Uchida [Fri, 23 Mar 2018 10:59:38 +0000 (19:59 +0900)]
Do not add the beginning vert to the match arm

Pass the span after the match's condition expression.
Closes #2554.

6 years agoMerge pull request #2549 from topecongiro/macro-def-spaces-around-colon
Nick Cameron [Thu, 22 Mar 2018 21:51:47 +0000 (10:51 +1300)]
Merge pull request #2549 from topecongiro/macro-def-spaces-around-colon

Add config option to control spaces around colon in macro def

6 years agoMerge pull request #2553 from topecongiro/rustc-ap-syntax
Nick Cameron [Thu, 22 Mar 2018 21:50:41 +0000 (10:50 +1300)]
Merge pull request #2553 from topecongiro/rustc-ap-syntax

Update rustc-ap-syntax to 73.0.0

6 years agoCargo fmt and update tests
topecongiro [Thu, 22 Mar 2018 07:09:21 +0000 (16:09 +0900)]
Cargo fmt and update tests

6 years agoRemove a space after a colon of metavariable def in macro def
topecongiro [Thu, 22 Mar 2018 07:08:57 +0000 (16:08 +0900)]
Remove a space after a colon of metavariable def in macro def

6 years agoUpdate a test
topecongiro [Thu, 22 Mar 2018 07:01:41 +0000 (16:01 +0900)]
Update a test

6 years agoUse `UseSegment::Slf` or `UseSegment::Super` when appropriate
topecongiro [Thu, 22 Mar 2018 06:56:51 +0000 (15:56 +0900)]
Use `UseSegment::Slf` or `UseSegment::Super` when appropriate

Currently we `UseSegment::Ident` for all of the segments except the last.
E.g. `use super::foo::bar::self;` will be
`[Ident("super"), Ident("foo"), Ident("bar"), Self(None)]`.
in the current implementation. I think that this should be
`[Super(None), Ident("foo"), Ident("bar"), Self(None)]`.
instead.

I noticed this because some tests failed after updating
`rustc-ap-syntax` to 73.0.0.

6 years agoFix libsyntax updates
topecongiro [Thu, 22 Mar 2018 06:55:14 +0000 (15:55 +0900)]
Fix libsyntax updates

`ast::UseTreeKind::Simple` now takes `Option<ast::Ident>`
instead of `ast::Ident`.

6 years agoFix libsyntax update
topecongiro [Thu, 22 Mar 2018 06:53:43 +0000 (15:53 +0900)]
Fix libsyntax update

Underscore is now one of keywords.

6 years agoCargo update
topecongiro [Thu, 22 Mar 2018 06:53:08 +0000 (15:53 +0900)]
Cargo update

Update rustc-ap-syntax to 73.0.0.

6 years agoMerge pull request #2552 from alanhdu/master
Nick Cameron [Thu, 22 Mar 2018 05:04:31 +0000 (18:04 +1300)]
Merge pull request #2552 from alanhdu/master

Close #2551

6 years agoClose #2551
Alan Du [Thu, 22 Mar 2018 04:57:22 +0000 (00:57 -0400)]
Close #2551

6 years agoFix build
Alan Du [Thu, 22 Mar 2018 04:01:09 +0000 (00:01 -0400)]
Fix build

6 years agoMerge pull request #2550 from sinkuu/chars_count_index
Nick Cameron [Thu, 22 Mar 2018 03:26:48 +0000 (16:26 +1300)]
Merge pull request #2550 from sinkuu/chars_count_index

Don't index a string with chars().count()/position()

6 years agoMerge pull request #2548 from topecongiro/match-mod
Nick Cameron [Thu, 22 Mar 2018 02:40:36 +0000 (15:40 +1300)]
Merge pull request #2548 from topecongiro/match-mod

Do not collapse block around expr with condition on match arm

6 years agoMerge pull request #2535 from nrc/import-ord
Nick Cameron [Thu, 22 Mar 2018 02:08:01 +0000 (15:08 +1300)]
Merge pull request #2535 from nrc/import-ord

Import ordering

6 years agoOmit unnecessary UTF-8 decoding
Shotaro Yamada [Wed, 21 Mar 2018 14:58:23 +0000 (23:58 +0900)]
Omit unnecessary UTF-8 decoding

6 years agoUse take_while
Shotaro Yamada [Wed, 21 Mar 2018 23:34:36 +0000 (08:34 +0900)]
Use take_while

6 years agoDon't index a string with `chars().count()`
Shotaro Yamada [Wed, 21 Mar 2018 23:32:42 +0000 (08:32 +0900)]
Don't index a string with `chars().count()`

6 years agoDo not collapse block around expr with condition on match arm
Seiichi Uchida [Wed, 21 Mar 2018 13:20:03 +0000 (22:20 +0900)]
Do not collapse block around expr with condition on match arm

Closes #2376.