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

6 years agoAdd a test for #2526
Seiichi Uchida [Fri, 9 Mar 2018 16:19:26 +0000 (01:19 +0900)]
Add a test for #2526

6 years agoDedupe syn/quote
Bastien Orivel [Fri, 9 Mar 2018 15:11:51 +0000 (16:11 +0100)]
Dedupe syn/quote

6 years agoSpecify required version of cargo_metadata
Rob Tsuk [Fri, 9 Mar 2018 14:40:39 +0000 (07:40 -0700)]
Specify required version of cargo_metadata

6 years agoCanonicalise the paths
Rob Tsuk [Thu, 8 Mar 2018 14:26:03 +0000 (07:26 -0700)]
Canonicalise the paths

6 years agoRestore cargo fmt behavior in workspaces
Rob Tsuk [Tue, 6 Mar 2018 14:28:08 +0000 (07:28 -0700)]
Restore cargo fmt behavior in workspaces

Previously, cargo fmt  invoked without parameters would
only format the crate in the current directory, even if
the crate was part of a workspace. This patch restores
that behavior.

6 years agoFormat macro call with item arguments
topecongiro [Fri, 9 Mar 2018 08:17:55 +0000 (17:17 +0900)]
Format macro call with item arguments

6 years agoAvoid unindenting code block in comment with unformattable macro
topecongiro [Fri, 9 Mar 2018 08:10:20 +0000 (17:10 +0900)]
Avoid unindenting code block in comment with unformattable macro

`format_code_block` formats the given `code_snippet` by enclosing it inside
`fn main` block. Previously we did not add indentation to the `code_snippet`
before formatting it. This works fine as long as we can format the given
`code_snippet`, but when the code block has unformattable macro, they gets
unindented. This commit fixes it by adding proper indentation before formatting
the `code_snippet`.

For example, when formatting the following code block,

```rust
some_macro!(pub fn foo() {
    println!("Don't unindent me!");
});
```

previously we enclosed it like this:

```rust
fn main() {
some_macro!(pub fn foo() {
    println!("Don't unindent me!");
});
}
```

with this PR, we will enclose it like this:

```rust
fn main() {
    some_macro!(pub fn foo() {
        println!("Don't unindent me!");
    });
}
```

Closes #2523.

6 years agoAdd a test for #2523
topecongiro [Fri, 9 Mar 2018 08:09:56 +0000 (17:09 +0900)]
Add a test for #2523

6 years agoUse Option<SeparatorTactic> over bool to control trailing comma
Seiichi Uchida [Wed, 7 Mar 2018 10:29:42 +0000 (19:29 +0900)]
Use Option<SeparatorTactic> over bool to control trailing comma

6 years agoAdd a test for #2510
Seiichi Uchida [Wed, 7 Mar 2018 06:53:17 +0000 (15:53 +0900)]
Add a test for #2510

Closes #2510.

6 years agoMake INDENT_BUFFER longer
Seiichi Uchida [Wed, 7 Mar 2018 06:49:55 +0000 (15:49 +0900)]
Make INDENT_BUFFER longer

Avoid panicking when indent whose width is 80 called `to_string()`.

6 years agoUpdate tests
Seiichi Uchida [Wed, 7 Mar 2018 06:49:15 +0000 (15:49 +0900)]
Update tests

6 years agoUse overflow::rewrite_with_angle_brackets to rewrite generics
Seiichi Uchida [Wed, 7 Mar 2018 06:48:47 +0000 (15:48 +0900)]
Use overflow::rewrite_with_angle_brackets to rewrite generics

6 years agoAdd overflow module
Seiichi Uchida [Wed, 7 Mar 2018 06:40:52 +0000 (15:40 +0900)]
Add overflow module

This commit adds `overflow` module. This module provides two APIs.
`rewrite_with_parens` is basically the same as `rewrite_call_inner`.
`rewrite_with_angle_brackets` is used for rewriting generics and types.

6 years agoUse RefCell for RewriteContext fields
Seiichi Uchida [Wed, 7 Mar 2018 06:37:44 +0000 (15:37 +0900)]
Use RefCell for RewriteContext fields

6 years agoAdd ignore config option
Seiichi Uchida [Fri, 9 Mar 2018 04:27:43 +0000 (13:27 +0900)]
Add ignore config option

For example, with the following config file, rustfmt will ignore `src/types.rs`,
`src/foo/bar.rs` and every file under `examples/` directory.

```toml
[ignore]
files = [
    "src/types.rs",
    "src/foo/bar.rs",
]
directories = [
    "examples",
]
```

6 years agoMerge pull request #2521 from topecongiro/issue-2520
Nick Cameron [Fri, 9 Mar 2018 02:18:53 +0000 (15:18 +1300)]
Merge pull request #2521 from topecongiro/issue-2520

Fix bugs when rewriting doc comments with code block

6 years agoMerge pull request #2519 from topecongiro/nested-parens
Nick Cameron [Fri, 9 Mar 2018 02:16:30 +0000 (15:16 +1300)]
Merge pull request #2519 from topecongiro/nested-parens

Remove nested parens

6 years agoMerge pull request #2518 from topecongiro/issue-2491
Nick Cameron [Fri, 9 Mar 2018 02:15:21 +0000 (15:15 +1300)]
Merge pull request #2518 from topecongiro/issue-2491

Disallow combining parens and brackets in impl

6 years agoCatch panics in the parser before they crash rustfmt
Nick Cameron [Fri, 9 Mar 2018 01:51:27 +0000 (14:51 +1300)]
Catch panics in the parser before they crash rustfmt

Closes #753

6 years agoKeep code block without correct backticks enclosing
Seiichi Uchida [Fri, 9 Mar 2018 00:46:43 +0000 (09:46 +0900)]
Keep code block without correct backticks enclosing

6 years agoRestrict the width of doc comments with comment_width
Seiichi Uchida [Fri, 9 Mar 2018 00:30:47 +0000 (09:30 +0900)]
Restrict the width of doc comments with comment_width

See the diff in tests/target/enum.rs for an example.

6 years agoFix a bug in attr::take_while_with_pred
Seiichi Uchida [Fri, 9 Mar 2018 00:29:08 +0000 (09:29 +0900)]
Fix a bug in attr::take_while_with_pred

Closes #2520.

6 years agoAdd a test for #2520
Seiichi Uchida [Fri, 9 Mar 2018 00:28:49 +0000 (09:28 +0900)]
Add a test for #2520

6 years agoList limitations in the README
Nick Cameron [Thu, 8 Mar 2018 22:15:16 +0000 (11:15 +1300)]
List limitations in the README

Closes #2109

6 years agoUpdate tests
Seiichi Uchida [Thu, 8 Mar 2018 11:25:41 +0000 (20:25 +0900)]
Update tests

6 years agoRemove nested parens
Seiichi Uchida [Thu, 8 Mar 2018 11:25:18 +0000 (20:25 +0900)]
Remove nested parens

And make sure that we do not remove comments within parens.

6 years agoAdd a test for removing nested parens
Seiichi Uchida [Thu, 8 Mar 2018 11:25:06 +0000 (20:25 +0900)]
Add a test for removing nested parens

6 years agoUpdate tests
Seiichi Uchida [Thu, 8 Mar 2018 10:08:56 +0000 (19:08 +0900)]
Update tests

6 years agoDisallow combining parens and brackets in impl
Seiichi Uchida [Thu, 8 Mar 2018 10:08:38 +0000 (19:08 +0900)]
Disallow combining parens and brackets in impl

6 years agoAdd a test for #2491
Seiichi Uchida [Thu, 8 Mar 2018 10:08:32 +0000 (19:08 +0900)]
Add a test for #2491

6 years agoCargo update and cargo clippy
Seiichi Uchida [Thu, 8 Mar 2018 07:29:00 +0000 (16:29 +0900)]
Cargo update and cargo clippy

6 years agofix adds a trailing comma to struct-like macro (#2490)
moe [Thu, 8 Mar 2018 09:05:39 +0000 (17:05 +0800)]
fix adds a trailing comma to struct-like macro (#2490)

* fix adds a trailing comma to struct-like macro

6 years agoPut lhs and rhs of binop on the same line if lhs is short
Seiichi Uchida [Thu, 8 Mar 2018 08:21:30 +0000 (17:21 +0900)]
Put lhs and rhs of binop on the same line if lhs is short

6 years agoAdd a test for #2493
Seiichi Uchida [Mon, 5 Mar 2018 14:38:16 +0000 (23:38 +0900)]
Add a test for #2493

6 years agoMerge pull request #2512 from topecongiro/rustc-ap-syntax
Nick Cameron [Thu, 8 Mar 2018 04:13:05 +0000 (17:13 +1300)]
Merge pull request #2512 from topecongiro/rustc-ap-syntax

Update rustc-ap-syntax

6 years agoReplace Option<Vec<&'a ast::pat>> with Vec<&'a ast::Pat>
Seiichi Uchida [Thu, 8 Mar 2018 03:56:28 +0000 (12:56 +0900)]
Replace Option<Vec<&'a ast::pat>> with Vec<&'a ast::Pat>

6 years agoMerge pull request #2456 from dlukes/feat/check-license
Nick Cameron [Thu, 8 Mar 2018 02:36:27 +0000 (15:36 +1300)]
Merge pull request #2456 from dlukes/feat/check-license

Attempt at checking for license (#209)

6 years agoMerge pull request #2508 from topecongiro/issue-2494
Nick Cameron [Thu, 8 Mar 2018 02:29:37 +0000 (15:29 +1300)]
Merge pull request #2508 from topecongiro/issue-2494

Only format code blocks in comments with rust syntax notation

6 years agoMerge pull request #2517 from davidalber/update-conduct
Nick Cameron [Thu, 8 Mar 2018 01:28:49 +0000 (14:28 +1300)]
Merge pull request #2517 from davidalber/update-conduct

Propagating upstream code of conduct changes

6 years agoSynchronizing with code of conduct in rust-www
David Alber [Wed, 7 Mar 2018 16:50:39 +0000 (08:50 -0800)]
Synchronizing with code of conduct in rust-www

This is propagated from rust-lang/rust-www#1062.

6 years agoMerge pull request #2515 from sinkuu/nested_shape_lazy_static
Seiichi Uchida [Wed, 7 Mar 2018 07:06:52 +0000 (16:06 +0900)]
Merge pull request #2515 from sinkuu/nested_shape_lazy_static

Use nested_shape for indenting types of lazy_static

6 years agoUse nested_shape for indenting types of lazy_static
Shotaro Yamada [Wed, 7 Mar 2018 01:51:28 +0000 (10:51 +0900)]
Use nested_shape for indenting types of lazy_static

6 years agoSupport parentheses in patterns
Seiichi Uchida [Tue, 6 Mar 2018 11:05:47 +0000 (20:05 +0900)]
Support parentheses in patterns

6 years agoFormat multiple patterns in 'if let' and `while let'
Seiichi Uchida [Tue, 6 Mar 2018 11:02:04 +0000 (20:02 +0900)]
Format multiple patterns in 'if let' and `while let'

Closes #2511.

6 years agoWork around removal of beginning_vert field from ast::Arm
Seiichi Uchida [Tue, 6 Mar 2018 10:56:49 +0000 (19:56 +0900)]
Work around removal of beginning_vert field from ast::Arm

`ast::Arm` used to have `beginning_vert` field whose type is `Option<Span>`
and holds a span of the beginning `|` if available. This field is now removed.
This commit works around that.

Since we only need a `BytePos` of the `|`, the type of `beginning_vert` in
`ArmWrapper` is `Option<BytePos>`.

6 years agoModify code around ast::Visibility
Seiichi Uchida [Tue, 6 Mar 2018 10:47:28 +0000 (19:47 +0900)]
Modify code around ast::Visibility

`ast::Visibility` is changed to `codemap::Spanned` whose node is
`ast::VisibilityKind`. This commit fixes it.

Closes #2398.

6 years agoAdd opt_span_before() to SpanUtils trait
Seiichi Uchida [Tue, 6 Mar 2018 10:46:03 +0000 (19:46 +0900)]
Add opt_span_before() to SpanUtils trait

With some refactorings to avoid duplicated code.

6 years agoCargo update
Seiichi Uchida [Tue, 6 Mar 2018 10:45:17 +0000 (19:45 +0900)]
Cargo update

Bump `rustc-ap-syntax` and `rustc-ap-rustc_errors` to `57.0.0`.

6 years agoAdd tests for #2398
Seiichi Uchida [Tue, 6 Mar 2018 10:42:55 +0000 (19:42 +0900)]
Add tests for #2398

6 years agoAdd tests for #2511
Seiichi Uchida [Tue, 6 Mar 2018 10:42:38 +0000 (19:42 +0900)]
Add tests for #2511

6 years agoMerge pull request #2507 from kngwyu/issue-2506
Seiichi Uchida [Mon, 5 Mar 2018 15:41:16 +0000 (00:41 +0900)]
Merge pull request #2507 from kngwyu/issue-2506

Issue 2506

6 years agoadd offset_left(4) for 'dyn '
kngwyu [Mon, 5 Mar 2018 13:45:40 +0000 (22:45 +0900)]
add offset_left(4) for 'dyn '

6 years agoMake license doctest pass again
David Lukes [Mon, 5 Mar 2018 12:39:30 +0000 (13:39 +0100)]
Make license doctest pass again

6 years agoLoad and compile template in proper function
David Lukes [Tue, 27 Feb 2018 14:00:29 +0000 (15:00 +0100)]
Load and compile template in proper function

Get rid of the unncessary closure.

6 years agoWrap license-related errors in enum
David Lukes [Mon, 26 Feb 2018 17:53:46 +0000 (18:53 +0100)]
Wrap license-related errors in enum

6 years agoAdd license_template_path configuration snippet
David Lukes [Mon, 26 Feb 2018 16:01:40 +0000 (17:01 +0100)]
Add license_template_path configuration snippet

6 years agoShorten var names to comply with line len reqs
David Lukes [Mon, 26 Feb 2018 14:57:31 +0000 (15:57 +0100)]
Shorten var names to comply with line len reqs