]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoImplement combining openings and closings
topecongiro [Sun, 21 May 2017 10:56:13 +0000 (19:56 +0900)]
Implement combining openings and closings

7 years agoMerge pull request #1565 from topecongiro/issue-1563
Seiichi Uchida [Tue, 23 May 2017 03:44:47 +0000 (12:44 +0900)]
Merge pull request #1565 from topecongiro/issue-1563

Implement vec![expr; expr] and avoid unnecessary indent in chain

7 years agoUpdate tests
topecongiro [Sun, 21 May 2017 23:50:46 +0000 (08:50 +0900)]
Update tests

7 years agoFormat source codes
topecongiro [Fri, 19 May 2017 10:31:29 +0000 (19:31 +0900)]
Format source codes

7 years agoRefactor source codes
topecongiro [Fri, 19 May 2017 10:31:01 +0000 (19:31 +0900)]
Refactor source codes

7 years agoAllow macro rewrite to fail on rhs
topecongiro [Fri, 19 May 2017 10:30:06 +0000 (19:30 +0900)]
Allow macro rewrite to fail on rhs

7 years agoFix weird indentaion in chain
topecongiro [Fri, 19 May 2017 10:28:00 +0000 (19:28 +0900)]
Fix weird indentaion in chain

7 years agoImplement 'vec![expr; expr]'
topecongiro [Fri, 19 May 2017 10:25:53 +0000 (19:25 +0900)]
Implement 'vec![expr; expr]'

7 years agoMerge pull request #1558 from mjkillough/config
Nick Cameron [Mon, 22 May 2017 00:13:22 +0000 (12:13 +1200)]
Merge pull request #1558 from mjkillough/config

Add a flag to emit which options are used

7 years agoMerge branch 'master' of https://github.com/rust-lang-nursery/rustfmt into config
Michael Killough [Fri, 19 May 2017 09:10:27 +0000 (16:10 +0700)]
Merge branch 'master' of https://github.com/rust-lang-nursery/rustfmt into config

7 years agoMerge pull request #1569 from mathstuf/example-typos
Nick Cameron [Thu, 18 May 2017 23:57:44 +0000 (11:57 +1200)]
Merge pull request #1569 from mathstuf/example-typos

Configurations: fix typos in example signatures

7 years agoMerge pull request #1568 from mathstuf/suffixes-typo
Nick Cameron [Thu, 18 May 2017 23:57:15 +0000 (11:57 +1200)]
Merge pull request #1568 from mathstuf/suffixes-typo

config: fix `suffices` -> `suffixes` typo

7 years agoConfigurations: fix typos in example signatures
Ben Boeckel [Thu, 18 May 2017 12:17:09 +0000 (08:17 -0400)]
Configurations: fix typos in example signatures

7 years agoconfig: fix `suffices` -> `suffixes` typo
Ben Boeckel [Thu, 18 May 2017 12:03:47 +0000 (08:03 -0400)]
config: fix `suffices` -> `suffixes` typo

Fixes #1477.

7 years agoMerge pull request #1562 from flier/reorder_imports_in_group
Seiichi Uchida [Thu, 18 May 2017 08:53:23 +0000 (17:53 +0900)]
Merge pull request #1562 from flier/reorder_imports_in_group

reorder imports in group

7 years agoMerge branch 'master' of https://github.com/rust-lang-nursery/rustfmt into config
Michael Killough [Thu, 18 May 2017 06:05:19 +0000 (13:05 +0700)]
Merge branch 'master' of https://github.com/rust-lang-nursery/rustfmt into config

7 years agoAdd --dump-default-config and --dump-minimal-config.
Michael Killough [Thu, 18 May 2017 05:56:49 +0000 (12:56 +0700)]
Add --dump-default-config and --dump-minimal-config.

 - `--dump-default-config` outputs the default configuration to the
   specified file as TOML and then exits.
 - `--dump-minimal-config` is checked after formatting files as normal.
   If present, any configuration options that were checked during
   formatting are written to the specified file as TOML.
 - These options were added only to `rustfmt`, not to `cargo fmt`. They
   can be specified when using `cargo fmt` by placing them after `--`.
 - It would have been nice if the filename was optional, so you could
   run just `rusfmt --dump-minimal-config build.rs` to have it output to
   `rustfmt.toml`. However, this doesn't do what you might expect: it
   outputs the config to `build.rs`!

7 years agoreorder imports in group
Flier Lu [Wed, 17 May 2017 10:32:18 +0000 (18:32 +0800)]
reorder imports in group

7 years agoReturn `PartialConfig` from `Config` methods.
Michael Killough [Thu, 18 May 2017 05:09:14 +0000 (12:09 +0700)]
Return `PartialConfig` from `Config` methods.

Leave serialization to the caller, but provide a
`PartialConfig.to_toml()` method, to deal with the fact that
`file_lines` can't be serialized.

Add a simple test.

7 years agoProvide `config.set().item(value)` API.
Michael Killough [Thu, 18 May 2017 04:37:29 +0000 (11:37 +0700)]
Provide `config.set().item(value)` API.

This API isn't fantastic, but it's the best I can come up with without
something like `concat_idents!()`. There are relatively few places where
config is set, to hopefully the ugliness isn't disastrous.

Change previous occurences of `config.item = value` to this new API,
rather than using `config.override_value()`. Undo the changes to
`override_value()`, as it's no longer important to propogate the error
to the caller. Add a test for the new interface.

7 years agoUse unreachable!() instead of panic!().
Michael Killough [Wed, 17 May 2017 10:16:35 +0000 (17:16 +0700)]
Use unreachable!() instead of panic!().

7 years agoRemove ConfigTracker - inline in Config.
Michael Killough [Wed, 17 May 2017 10:14:48 +0000 (17:14 +0700)]
Remove ConfigTracker - inline in Config.

Use an individual `Cell<bool>` on each config item, rather than
maintaining a set of config names that were accessed. Add a simple unit
test.

7 years agoMerge pull request #1560 from topecongiro/issue-1441
Nick Cameron [Wed, 17 May 2017 22:51:21 +0000 (10:51 +1200)]
Merge pull request #1560 from topecongiro/issue-1441

Use multiline when signature does not fit single line

7 years agoBump version of strings.rs and cargo update
Nick Cameron [Wed, 17 May 2017 19:59:09 +0000 (07:59 +1200)]
Bump version of strings.rs and cargo update

7 years agoUse multiline when signature does not fit single line
topecongiro [Wed, 17 May 2017 07:31:09 +0000 (16:31 +0900)]
Use multiline when signature does not fit single line

7 years agoAdd note about libsyntax branch to README
Nick Cameron [Wed, 17 May 2017 07:07:25 +0000 (19:07 +1200)]
Add note about libsyntax branch to README

7 years agoMerge pull request #1559 from topecongiro/poor/chain
Nick Cameron [Wed, 17 May 2017 05:43:42 +0000 (17:43 +1200)]
Merge pull request #1559 from topecongiro/poor/chain

Allow the last element in chain to go multiline

7 years agoMerge pull request #1557 from mjkillough/issue_1366
Nick Cameron [Tue, 16 May 2017 21:58:49 +0000 (09:58 +1200)]
Merge pull request #1557 from mjkillough/issue_1366

Add test for issue #1366.

7 years agoFormat source codes
topecongiro [Tue, 16 May 2017 14:24:38 +0000 (23:24 +0900)]
Format source codes

7 years agoAllow last child in chain to go multiline
topecongiro [Tue, 16 May 2017 14:24:00 +0000 (23:24 +0900)]
Allow last child in chain to go multiline

7 years agoAdd methods to serialize Config to TOML.
Michael Killough [Tue, 16 May 2017 11:08:24 +0000 (18:08 +0700)]
Add methods to serialize Config to TOML.

Two different modes:

 - Serialize the full Config object. This is useful as
   `Config::default().to_toml()` to output a rustfmt.toml with defaults
   (#317).
 - Serialize only the options that have been accessed. This could be
   useful to output a minimal rustfmt.toml for a project. (If the
   default value of any unused config item changes, you'll then get the
   new default when you come to use it).

This commit doesn't expose this anywhere - deciding a sensible CLI is a
bit trickier.

This commit also has very simple error reporting (Result<String,
String>) - once the CLI is decided, a more sensible method of reporting
errors might become obvious.

7 years agoTrack which config items are accessed.
Michael Killough [Tue, 16 May 2017 11:05:40 +0000 (18:05 +0700)]
Track which config items are accessed.

Required by #865. This doesn't introduce any method to view which
parameters are accessed.

We record which config items are accessed even if we don't intend to
output them, as we assume it will be a relatively cheap operation.

7 years agoAdd test for issue #1366.
Michael Killough [Tue, 16 May 2017 09:13:23 +0000 (16:13 +0700)]
Add test for issue #1366.

As the comments in the issue state: it appears to work now, so this test
should just stop any regressions.

The second example in the issue description will format to the first,
which is then a fixed-point.

7 years agoSwitch to accessing config items via method.
Michael Killough [Tue, 16 May 2017 08:47:09 +0000 (15:47 +0700)]
Switch to accessing config items via method.

Preparation for #865, which proposes adding a flag which outputs which
config options are used during formatting.

This PR should not make any difference to functionality. A lot of this
was search-and-replace.

Some areas worthy of review/discussion:

 - The method for each config item returns a clone of the underlying
   value. We can't simply return an immutable reference, as lots of
   places in the code expect to be able to pass the returned value as
   `bool` (not `&bool). It would be nice if the `bool` items could
   return a copy, but the more complex types a borrowed reference... but
   unfortunately, I couldn't get the macro to do this.
 - A few places (mostly tests and `src/bin/rustfmt.rs`) were overriding
   config items by modifying the fields of the `Config` struct directly.
   They now use the existing `override_value()` method, which has been
   modified to return a `Result` for use by `src/bin/rustfmt.rs`. This
   benefits of this are that the complex `file_lines` and `write_mode`
   strings are now parsed in one place (`Config.override_value`) instead
   of multiple. The disadvantages are that it moves the compile-time
   checks for config names to become run-time checks.

7 years agoMerge pull request #1556 from topecongiro/issue-1555
Nick Cameron [Mon, 15 May 2017 21:55:07 +0000 (09:55 +1200)]
Merge pull request #1556 from topecongiro/issue-1555

Only add offset for unary op

7 years agoFormat source codes
Seiichi Uchida [Mon, 15 May 2017 13:55:45 +0000 (22:55 +0900)]
Format source codes

7 years agoUse offset_left for rewrite_unary_prefix
Seiichi Uchida [Mon, 15 May 2017 13:55:01 +0000 (22:55 +0900)]
Use offset_left for rewrite_unary_prefix

7 years agoMerge pull request #1510 from fintelia/better-filelines
Nick Cameron [Sun, 14 May 2017 21:19:18 +0000 (09:19 +1200)]
Merge pull request #1510 from fintelia/better-filelines

Better file_lines

7 years agoMerge pull request #1551 from topecongiro/else-if-early-line-break
Nick Cameron [Sun, 14 May 2017 20:59:03 +0000 (08:59 +1200)]
Merge pull request #1551 from topecongiro/else-if-early-line-break

Forbid early line breaks inside else if

7 years agoMerge pull request #1550 from topecongiro/issue-1547
Nick Cameron [Sun, 14 May 2017 20:46:14 +0000 (08:46 +1200)]
Merge pull request #1550 from topecongiro/issue-1547

Prevent rewriting closure block to expr inside macro

7 years agoMerge pull request #1552 from guanqun/give-specific-errors
Nick Cameron [Sun, 14 May 2017 06:08:27 +0000 (18:08 +1200)]
Merge pull request #1552 from guanqun/give-specific-errors

add more specific reason why it fails to parse

7 years agoadd more specific reason why it fails to parse
Guanqun Lu [Sun, 14 May 2017 05:19:06 +0000 (13:19 +0800)]
add more specific reason why it fails to parse

7 years agoAdd and improve tests of file_lines
Jonathan Behrens [Sat, 13 May 2017 17:15:17 +0000 (13:15 -0400)]
Add and improve tests of file_lines

7 years agoRefactor file range checking
Jonathan Behrens [Sat, 13 May 2017 17:14:24 +0000 (13:14 -0400)]
Refactor file range checking

7 years agoFormat source code
Seiichi Uchida [Sat, 13 May 2017 12:08:10 +0000 (21:08 +0900)]
Format source code

7 years agoUse precise width when rewriting else if
Seiichi Uchida [Sat, 13 May 2017 12:07:36 +0000 (21:07 +0900)]
Use precise width when rewriting else if

7 years agoPrevent rewriting closure block to expr inside macro
Seiichi Uchida [Sat, 13 May 2017 09:20:18 +0000 (18:20 +0900)]
Prevent rewriting closure block to expr inside macro

7 years agoMerge pull request #1546 from topecongiro/bug/range-full
Seiichi Uchida [Sat, 13 May 2017 08:40:47 +0000 (17:40 +0900)]
Merge pull request #1546 from topecongiro/bug/range-full

Add a missing trailing comma before elipses

7 years agoAdd a missing trailing comma before elipses
topecongiro [Fri, 12 May 2017 21:44:57 +0000 (06:44 +0900)]
Add a missing trailing comma before elipses

7 years agoMerge pull request #1530 from azyobuzin/vscodeextlink
Nick Cameron [Fri, 12 May 2017 21:54:09 +0000 (09:54 +1200)]
Merge pull request #1530 from azyobuzin/vscodeextlink

Change the link of Visual Studio Code extension

7 years agoMerge pull request #1543 from topecongiro/field-attr
Seiichi Uchida [Fri, 12 May 2017 11:08:36 +0000 (20:08 +0900)]
Merge pull request #1543 from topecongiro/field-attr

Support struct_field_attributes

7 years agoAdd a link of rls_vscode
azyobuzin [Fri, 12 May 2017 11:06:28 +0000 (20:06 +0900)]
Add a link of rls_vscode

7 years agoSupport struct_field_attributes
topecongiro [Fri, 12 May 2017 08:58:38 +0000 (17:58 +0900)]
Support struct_field_attributes

7 years agoMerge pull request #1540 from topecongiro/fn_call_width
Nick Cameron [Fri, 12 May 2017 08:49:58 +0000 (20:49 +1200)]
Merge pull request #1540 from topecongiro/fn_call_width

Use vertical layout when args len is larger than fn_call_width

7 years agoUse vertical layout when args len is larger than fn_call_width
topecongiro [Fri, 12 May 2017 07:30:26 +0000 (16:30 +0900)]
Use vertical layout when args len is larger than fn_call_width

7 years agoMerge pull request #1529 from topecongiro/issue-1528
Nick Cameron [Fri, 12 May 2017 03:04:01 +0000 (15:04 +1200)]
Merge pull request #1529 from topecongiro/issue-1528

Use newline only when fn_call_style is Block

7 years agoTry multi-line only when fn_call_style is Block and rewriting function call
topecongiro [Thu, 11 May 2017 04:38:26 +0000 (13:38 +0900)]
Try multi-line only when fn_call_style is Block and rewriting function call

7 years agoChange the link of Visual Studio Code extension
azyobuzin [Thu, 11 May 2017 09:48:27 +0000 (18:48 +0900)]
Change the link of Visual Studio Code extension

RustyCode is no longer maintained.

7 years agobump version (0.8.4) and cargo update
Nick Cameron [Tue, 9 May 2017 22:38:35 +0000 (10:38 +1200)]
bump version (0.8.4) and cargo update

7 years agoMerge pull request #1523 from topecongiro/poor-formatting/fn_call_style
Nick Cameron [Tue, 9 May 2017 20:27:24 +0000 (08:27 +1200)]
Merge pull request #1523 from topecongiro/poor-formatting/fn_call_style

Use multiline when args exceeds max_width in fn_call_style = "block"

7 years agoMerge pull request #1522 from topecongiro/poor-formatting/if-else
Nick Cameron [Tue, 9 May 2017 20:20:24 +0000 (08:20 +1200)]
Merge pull request #1522 from topecongiro/poor-formatting/if-else

Inherit alignment to 'else'

7 years agoUse multiline when args exceeds max_width in fn_call_style = "block"
topecongiro [Tue, 9 May 2017 15:27:57 +0000 (00:27 +0900)]
Use multiline when args exceeds max_width in fn_call_style = "block"

7 years agoInherit alignment to last else
topecongiro [Tue, 9 May 2017 08:33:45 +0000 (17:33 +0900)]
Inherit alignment to last else

7 years agoRefactor rewrite_pat_expr
topecongiro [Tue, 9 May 2017 08:33:28 +0000 (17:33 +0900)]
Refactor rewrite_pat_expr

7 years agoMerge pull request #1519 from topecongiro/poor-formatting/if-else
Nick Cameron [Tue, 9 May 2017 03:21:29 +0000 (15:21 +1200)]
Merge pull request #1519 from topecongiro/poor-formatting/if-else

Remove visual_indent when rewriting else block

7 years agoMerge pull request #1520 from topecongiro/allow-match
Nick Cameron [Tue, 9 May 2017 03:21:06 +0000 (15:21 +1200)]
Merge pull request #1520 from topecongiro/allow-match

Apply closure exception to match in args

7 years agoApply closure exception to match in args
topecongiro [Mon, 8 May 2017 23:28:05 +0000 (08:28 +0900)]
Apply closure exception to match in args

7 years agoRemove visual_indent when rewriting else block
topecongiro [Mon, 8 May 2017 23:11:05 +0000 (08:11 +0900)]
Remove visual_indent when rewriting else block

7 years agoMerge pull request #1516 from topecongiro/remove-try
Nick Cameron [Mon, 8 May 2017 04:32:05 +0000 (16:32 +1200)]
Merge pull request #1516 from topecongiro/remove-try

Replace 'try!' with '?'

7 years agoReplace 'try!' with '?'
topecongiro [Mon, 8 May 2017 04:13:49 +0000 (13:13 +0900)]
Replace 'try!' with '?'

7 years agoMerge pull request #1506 from topecongiro/issue-1351
Nick Cameron [Mon, 8 May 2017 01:37:01 +0000 (13:37 +1200)]
Merge pull request #1506 from topecongiro/issue-1351

Use block indent if visual indent exceeds max_width when rewriting block

7 years agoUse block indent when visual indent failed
topecongiro [Sun, 7 May 2017 23:07:18 +0000 (08:07 +0900)]
Use block indent when visual indent failed

7 years agoMerge pull request #1442 from topecongiro/poor-formatting/trailing-comma
Nick Cameron [Sun, 7 May 2017 22:45:03 +0000 (10:45 +1200)]
Merge pull request #1442 from topecongiro/poor-formatting/trailing-comma

Remove comma from function definition with a single argument

7 years agoMerge pull request #1511 from topecongiro/bug/closure-fallback
Nick Cameron [Sun, 7 May 2017 22:30:50 +0000 (10:30 +1200)]
Merge pull request #1511 from topecongiro/bug/closure-fallback

Add fallback path inside rewrite_closure

7 years agoMerge pull request #1513 from topecongiro/refactoring
Nick Cameron [Sun, 7 May 2017 22:29:02 +0000 (10:29 +1200)]
Merge pull request #1513 from topecongiro/refactoring

Add methods to Shape

7 years agoRefactor Shape
topecongiro [Sun, 7 May 2017 22:24:32 +0000 (07:24 +0900)]
Refactor Shape

7 years agoAdd indented and with_max_width
topecongiro [Sun, 7 May 2017 22:24:12 +0000 (07:24 +0900)]
Add indented and with_max_width

7 years agoMerge pull request #1512 from topecongiro/config-path
Nick Cameron [Sun, 7 May 2017 22:15:41 +0000 (10:15 +1200)]
Merge pull request #1512 from topecongiro/config-path

Allow config-path to point to a file

7 years agoAllow config-path to point to a file
topecongiro [Sun, 7 May 2017 07:44:03 +0000 (16:44 +0900)]
Allow config-path to point to a file

7 years agoAdd fallback path
topecongiro [Sun, 7 May 2017 04:06:54 +0000 (13:06 +0900)]
Add fallback path

7 years agoRespect file_lines within write_snippet() function
Jonathan Behrens [Sat, 6 May 2017 21:59:51 +0000 (17:59 -0400)]
Respect file_lines within write_snippet() function

7 years agoRespect file_lines within format_lines() function
Jonathan Behrens [Sat, 6 May 2017 19:14:44 +0000 (15:14 -0400)]
Respect file_lines within format_lines() function

7 years agoBlock format control flow discriminant expressions and binops
Nick Cameron [Fri, 5 May 2017 02:29:18 +0000 (14:29 +1200)]
Block format control flow discriminant expressions and binops

Fixes #1450

Adds control_style option

7 years agoUpdate tests
topecongiro [Thu, 4 May 2017 06:17:57 +0000 (15:17 +0900)]
Update tests

7 years agoMerge pull request #1502 from topecongiro/tests
Nick Cameron [Thu, 4 May 2017 23:04:26 +0000 (11:04 +1200)]
Merge pull request #1502 from topecongiro/tests

Add tests for issues which can be closed on master

7 years agoUse SeperatorTactic::Never for a single argument
topecongiro [Fri, 7 Apr 2017 07:53:49 +0000 (16:53 +0900)]
Use SeperatorTactic::Never for a single argument

7 years agoAdd tests for issues which can be closed on master
topecongiro [Thu, 4 May 2017 04:52:35 +0000 (13:52 +0900)]
Add tests for issues which can be closed on master

7 years agoMerge pull request #1495 from topecongiro/poor-formatting/closure
Nick Cameron [Thu, 4 May 2017 05:15:58 +0000 (17:15 +1200)]
Merge pull request #1495 from topecongiro/poor-formatting/closure

Fix weird indentation inside closures

7 years agoMerge pull request #1500 from shioju/master
Nick Cameron [Wed, 3 May 2017 22:00:03 +0000 (10:00 +1200)]
Merge pull request #1500 from shioju/master

Format macros in trait item position

7 years agoMerge pull request #1496 from est31/master
Nick Cameron [Wed, 3 May 2017 21:12:21 +0000 (09:12 +1200)]
Merge pull request #1496 from est31/master

Drop rustc-serialize, use serde, update toml dependency

7 years agoFormat macros in trait item position
Sheng Hau [Wed, 3 May 2017 16:10:03 +0000 (00:10 +0800)]
Format macros in trait item position

7 years agoCheck format failures explicitly in visit_block
topecongiro [Wed, 3 May 2017 15:21:51 +0000 (00:21 +0900)]
Check format failures explicitly in visit_block

7 years agoFormat fix
est31 [Wed, 3 May 2017 15:16:58 +0000 (17:16 +0200)]
Format fix

7 years agoSimplifications
est31 [Wed, 3 May 2017 15:11:34 +0000 (17:11 +0200)]
Simplifications

7 years agoDrop rustc-serialize, use serde, update toml dependency
est31 [Wed, 3 May 2017 08:23:50 +0000 (10:23 +0200)]
Drop rustc-serialize, use serde, update toml dependency

7 years agocargo update
Nick Cameron [Wed, 3 May 2017 06:02:48 +0000 (18:02 +1200)]
cargo update

7 years agoUpdate tests
topecongiro [Wed, 3 May 2017 02:26:31 +0000 (11:26 +0900)]
Update tests

7 years agoFormat source codes
topecongiro [Wed, 3 May 2017 02:26:25 +0000 (11:26 +0900)]
Format source codes

7 years agoKeep a chain with length chain_one_line_max in a single line
topecongiro [Wed, 3 May 2017 02:24:08 +0000 (11:24 +0900)]
Keep a chain with length chain_one_line_max in a single line

7 years agoSplit a long chain with a single child
topecongiro [Wed, 3 May 2017 02:22:36 +0000 (11:22 +0900)]
Split a long chain with a single child