]> git.lizzy.rs Git - rust.git/log
rust.git
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 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.

6 years agoAdd matches module
Seiichi Uchida [Wed, 21 Mar 2018 13:02:18 +0000 (22:02 +0900)]
Add matches module

`matches` module contains `rewrite_match` and related stuffs.

6 years agoReturn grouping `extern crate` to true by default
Nick Cameron [Mon, 19 Mar 2018 20:54:00 +0000 (09:54 +1300)]
Return grouping `extern crate` to true by default

6 years agoreviewer comments and rebase fallout
Nick Cameron [Fri, 16 Mar 2018 07:57:35 +0000 (20:57 +1300)]
reviewer comments and rebase fallout

6 years agoBetter handle comments and newlines around erased imports
Nick Cameron [Thu, 15 Mar 2018 19:18:56 +0000 (08:18 +1300)]
Better handle comments and newlines around erased imports

6 years agofixup tests
Nick Cameron [Thu, 15 Mar 2018 01:06:54 +0000 (14:06 +1300)]
fixup tests

6 years agocargo fmt
Nick Cameron [Wed, 14 Mar 2018 07:43:01 +0000 (20:43 +1300)]
cargo fmt

6 years agoReimplement import reordering.
Nick Cameron [Mon, 12 Mar 2018 07:56:02 +0000 (20:56 +1300)]
Reimplement import reordering.

6 years agoformat code and tests
Nick Cameron [Mon, 12 Mar 2018 04:24:04 +0000 (17:24 +1300)]
format code and tests

6 years agoReorder imports by default
Nick Cameron [Mon, 12 Mar 2018 03:53:06 +0000 (16:53 +1300)]
Reorder imports by default

6 years agoMerge pull request #2542 from topecongiro/macro-2.0
Nick Cameron [Mon, 19 Mar 2018 02:13:47 +0000 (15:13 +1300)]
Merge pull request #2542 from topecongiro/macro-2.0

Handle macro arguments which exceeds max width

6 years agoPut a space before colon that appears after a meta variable
Seiichi Uchida [Sun, 18 Mar 2018 05:29:36 +0000 (14:29 +0900)]
Put a space before colon that appears after a meta variable

Closes #2534.

6 years agoPut spaces around braces
Seiichi Uchida [Sun, 18 Mar 2018 05:08:24 +0000 (14:08 +0900)]
Put spaces around braces

6 years agoAdd some doc comments and factor out add_repeat and add_delimited
Seiichi Uchida [Sun, 18 Mar 2018 04:49:06 +0000 (13:49 +0900)]
Add some doc comments and factor out add_repeat and add_delimited

6 years agoHandle binary operators and lifetimes
Seiichi Uchida [Sun, 18 Mar 2018 04:12:16 +0000 (13:12 +0900)]
Handle binary operators and lifetimes

6 years agoBreak before meta variables when using multiple lines
Seiichi Uchida [Sun, 18 Mar 2018 03:33:59 +0000 (12:33 +0900)]
Break before meta variables when using multiple lines

6 years agoRemove has_prefix_space
Seiichi Uchida [Sun, 18 Mar 2018 03:33:30 +0000 (12:33 +0900)]
Remove has_prefix_space

6 years agoFormat macro arguments with vertical layout
Seiichi Uchida [Sat, 17 Mar 2018 16:08:18 +0000 (01:08 +0900)]
Format macro arguments with vertical layout

6 years agoRemove unit tests
Seiichi Uchida [Sat, 17 Mar 2018 16:08:10 +0000 (01:08 +0900)]
Remove unit tests

6 years agoUpdate tests
Seiichi Uchida [Sat, 17 Mar 2018 16:08:02 +0000 (01:08 +0900)]
Update tests

6 years agoMerge pull request #2541 from topecongiro/issue-2358
Nick Cameron [Sun, 18 Mar 2018 19:55:35 +0000 (08:55 +1300)]
Merge pull request #2541 from topecongiro/issue-2358

Skip name replacement in comments and strings

6 years agoMerge pull request #2540 from topecongiro/version
Nick Cameron [Sun, 18 Mar 2018 19:53:31 +0000 (08:53 +1300)]
Merge pull request #2540 from topecongiro/version

Fix print_version

6 years agoRemove FIXME about duplicated code
Seiichi Uchida [Sat, 17 Mar 2018 05:59:39 +0000 (14:59 +0900)]
Remove FIXME about duplicated code

6 years agoSkip name replacement in comments and strings
Seiichi Uchida [Sat, 17 Mar 2018 05:59:26 +0000 (14:59 +0900)]
Skip name replacement in comments and strings

6 years agoAdd a test for #2538
Seiichi Uchida [Sat, 17 Mar 2018 05:58:56 +0000 (14:58 +0900)]
Add a test for #2538

6 years agoFix print_version
Seiichi Uchida [Sat, 17 Mar 2018 03:16:15 +0000 (12:16 +0900)]
Fix print_version

6 years ago0.4.1
topecongiro [Thu, 15 Mar 2018 23:58:25 +0000 (08:58 +0900)]
0.4.1

6 years agoCargo update
topecongiro [Thu, 15 Mar 2018 23:52:30 +0000 (08:52 +0900)]
Cargo update

Remove `rustc-ap-rustc_errors` from dependencies since it
is re-exported from `rustc-ap-syntax`.

6 years agoMerge pull request #2509 from topecongiro/issue-2493
Nick Cameron [Thu, 15 Mar 2018 18:30:30 +0000 (07:30 +1300)]
Merge pull request #2509 from topecongiro/issue-2493

Overflow the last rhs of a binary expression

6 years agoMerge pull request #2533 from topecongiro/rustc-ap-syntax
Nick Cameron [Thu, 15 Mar 2018 18:26:50 +0000 (07:26 +1300)]
Merge pull request #2533 from topecongiro/rustc-ap-syntax

Update to the latest rustc-ap-syntax

6 years agoCall syntax::with_globals before using a parser
Seiichi Uchida [Thu, 15 Mar 2018 09:55:52 +0000 (18:55 +0900)]
Call syntax::with_globals before using a parser

6 years agoCargo update
Seiichi Uchida [Thu, 15 Mar 2018 09:55:31 +0000 (18:55 +0900)]
Cargo update

Update `rustc-ap-syntax` to `67.0.0`.

6 years agoMerge branch 'matthew-mcallister-attrib-block-expr'
Seiichi Uchida [Tue, 13 Mar 2018 16:16:57 +0000 (01:16 +0900)]
Merge branch 'matthew-mcallister-attrib-block-expr'

6 years agoFormat attributes on block expressions
Matthew McAllister [Sat, 21 Oct 2017 05:09:45 +0000 (22:09 -0700)]
Format attributes on block expressions

6 years agoUpdate CHANGELOG
Seiichi Uchida [Tue, 13 Mar 2018 15:38:42 +0000 (00:38 +0900)]
Update CHANGELOG

6 years agoMerge pull request #2522 from topecongiro/ignore-config-option
Nick Cameron [Mon, 12 Mar 2018 03:25:31 +0000 (16:25 +1300)]
Merge pull request #2522 from topecongiro/ignore-config-option

Add ignore config option

6 years agoMerge pull request #2528 from topecongiro/rfc/trait-impl-where
Nick Cameron [Mon, 12 Mar 2018 03:25:12 +0000 (16:25 +1300)]
Merge pull request #2528 from topecongiro/rfc/trait-impl-where

Implement RFC style for trait

6 years agoSimplify IgnoreList
topecongiro [Sun, 11 Mar 2018 23:41:19 +0000 (08:41 +0900)]
Simplify IgnoreList

6 years agoSimplify join_bounds()
Seiichi Uchida [Sat, 10 Mar 2018 06:23:42 +0000 (15:23 +0900)]
Simplify join_bounds()

6 years agoAdd a test for #2497
Seiichi Uchida [Sat, 10 Mar 2018 06:11:49 +0000 (15:11 +0900)]
Add a test for #2497

Closes #2497.

6 years agoUpdate tests
Seiichi Uchida [Sat, 10 Mar 2018 05:57:31 +0000 (14:57 +0900)]
Update tests

This is an unintentional side effect of this PR. Nonetheless the diff looks
harmless to me, and it is only relevant when `indent_style = Visual`.
So I think this is ok.

6 years agoModify the placement of the opening brace of trait
Seiichi Uchida [Sat, 10 Mar 2018 05:55:30 +0000 (14:55 +0900)]
Modify the placement of the opening brace of trait

Put the opening brace on the next line if

1. putting it one the current line exceeds max width.
2. trait bounds uses multiple lines.

6 years agoUse rewrite_assign_rhs for rewriting bounds
Seiichi Uchida [Sat, 10 Mar 2018 05:54:13 +0000 (14:54 +0900)]
Use rewrite_assign_rhs for rewriting bounds

6 years agoAdd rewrite_assign_rhs_with
Seiichi Uchida [Sat, 10 Mar 2018 05:35:53 +0000 (14:35 +0900)]
Add rewrite_assign_rhs_with

It is like `rewrite_assign_rhs` but lets us force to put the rhs on the next
line if it uses multiple lines.

This lets us avoid duplicating logic for choosing whether to put stuff on the
same line or the next line.

6 years agoUpdate tests for traits with long bounds
Seiichi Uchida [Sat, 10 Mar 2018 05:30:47 +0000 (14:30 +0900)]
Update tests for traits with long bounds

The colon should be next to the ident instead of on the next line.

6 years agoUpdate tests for braces on trait
Seiichi Uchida [Sat, 10 Mar 2018 05:29:01 +0000 (14:29 +0900)]
Update tests for braces on trait

Test that the opening brace of trait with long name or bounds with multiple
lines will be put on the next line.

6 years agoMerge pull request #2513 from rtsuk/master
Nick Cameron [Sun, 11 Mar 2018 22:26:12 +0000 (11:26 +1300)]
Merge pull request #2513 from rtsuk/master

Restore cargo fmt behavior in workspaces

6 years agoMerge pull request #2527 from topecongiro/issue-2526
Nick Cameron [Sun, 11 Mar 2018 22:25:40 +0000 (11:25 +1300)]
Merge pull request #2527 from topecongiro/issue-2526

Check whether '\\'' is char literal or lifetime

6 years agoMerge pull request #2524 from topecongiro/issue-2523
Nick Cameron [Sun, 11 Mar 2018 22:21:09 +0000 (11:21 +1300)]
Merge pull request #2524 from topecongiro/issue-2523

Do not unindent code block in comments with unformattable macro

6 years agoMerge pull request #2516 from topecongiro/issue-2510
Nick Cameron [Sun, 11 Mar 2018 22:18:14 +0000 (11:18 +1300)]
Merge pull request #2516 from topecongiro/issue-2510

Make rewrite_call_inner more generic

6 years agoMerge pull request #2529 from dlukes/feat/enable-doctests
Seiichi Uchida [Sat, 10 Mar 2018 12:24:35 +0000 (21:24 +0900)]
Merge pull request #2529 from dlukes/feat/enable-doctests

Enable doctests

6 years agoEnable doctests
David Lukes [Sat, 10 Mar 2018 08:57:01 +0000 (09:57 +0100)]
Enable doctests

Doctests were disabled globally because up until #2456, they were just
formatting examples which were not supposed to compile. Now that there
is one runnable doctest, I disabled the other ones individually (by
adding the ignore directive).

I also added some empty lines around the code blocks to avoid the
following warning and instead ignore the code blocks cleanly:

WARNING: ... Code block is not currently run as a test, but will in
future versions of rustdoc. Please ensure this code block is a runnable
test, or use the `ignore` directive.

See rust-lang/rust#28712 for further details.

6 years agoMerge pull request #2525 from Eijebong/dedup
Seiichi Uchida [Sat, 10 Mar 2018 02:53:15 +0000 (11:53 +0900)]
Merge pull request #2525 from Eijebong/dedup

Dedupe syn/quote

6 years agoCheck whether '\\'' is char literal or lifetime
Seiichi Uchida [Fri, 9 Mar 2018 16:19:38 +0000 (01:19 +0900)]
Check whether '\\'' is char literal or lifetime