]>
git.lizzy.rs Git - rust.git/log
Nick Cameron [Tue, 30 May 2017 23:58:03 +0000 (11:58 +1200)]
Merge pull request #1609 from topecongiro/nested-tuple
Put a space between nested tuple field
topecongiro [Tue, 30 May 2017 11:40:05 +0000 (20:40 +0900)]
Put a space between nested tuple field
Nick Cameron [Tue, 30 May 2017 03:28:44 +0000 (15:28 +1200)]
Merge pull request #1608 from topecongiro/issue-1598
Fix index bug in write_snippet_inner
Nick Cameron [Tue, 30 May 2017 03:28:11 +0000 (15:28 +1200)]
Merge pull request #1607 from topecongiro/many-slashes
Allow longer custom comments
topecongiro [Tue, 30 May 2017 01:53:48 +0000 (10:53 +0900)]
Fix index bug in write_snippet_inner
topecongiro [Mon, 29 May 2017 23:15:12 +0000 (08:15 +0900)]
Allow longer custom comment
Nick Cameron [Mon, 29 May 2017 20:53:22 +0000 (08:53 +1200)]
Merge pull request #1604 from topecongiro/comment-group
Format comments with different opening in different manner
topecongiro [Sun, 28 May 2017 10:10:05 +0000 (19:10 +0900)]
Use different style when rewriting comment with different opener
Nick Cameron [Sun, 28 May 2017 06:34:50 +0000 (18:34 +1200)]
Merge pull request #1602 from topecongiro/attributes-on-expressions
Allow attributes on expressions
Nick Cameron [Sun, 28 May 2017 06:32:15 +0000 (18:32 +1200)]
Merge pull request #1601 from topecongiro/issue-1600
Allow attributes in generics of impl
Nick Cameron [Sun, 28 May 2017 06:30:58 +0000 (18:30 +1200)]
Merge pull request #1599 from topecongiro/performance/binary-search
Avoid unnecessary binary search in rewrite_call
topecongiro [Sun, 7 May 2017 21:44:48 +0000 (06:44 +0900)]
Add tests for issues which can be closed on the current master
This PR adds tests for #325, #1092, #1214, #1278, #1329 and #1427.
topecongiro [Sun, 28 May 2017 02:41:16 +0000 (11:41 +0900)]
Allow attributes on expressions
Seiichi Uchida [Sat, 27 May 2017 14:59:29 +0000 (23:59 +0900)]
Allow attributes in generics of impl
Seiichi Uchida [Sat, 27 May 2017 09:48:42 +0000 (18:48 +0900)]
Avoid unnecessary binary search in rewrite_call
Nick Cameron [Sat, 27 May 2017 01:47:42 +0000 (13:47 +1200)]
Merge pull request #1597 from topecongiro/comments-after-attributes
Allow comments after attributes of struct fields
Nick Cameron [Sat, 27 May 2017 01:38:14 +0000 (13:38 +1200)]
Merge pull request #1596 from topecongiro/issue-1595
Add a trailing comma if the last arg ends with comment
Nick Cameron [Sat, 27 May 2017 01:34:50 +0000 (13:34 +1200)]
Merge pull request #1593 from topecongiro/issue-1439
Allow comments after where clause
Nick Cameron [Sat, 27 May 2017 01:28:47 +0000 (13:28 +1200)]
Merge pull request #1588 from topecongiro/nesting-macro
Allow macro to be nested like function call
Nick Cameron [Sat, 27 May 2017 01:14:16 +0000 (13:14 +1200)]
Merge pull request #1591 from topecongiro/associated-type-defaults
Allow default associated types
topecongiro [Sat, 27 May 2017 00:36:25 +0000 (09:36 +0900)]
Allow comments after attributes of struct fields
topecongiro [Fri, 26 May 2017 22:33:06 +0000 (07:33 +0900)]
Add a trailing comma if the last arg ends with comment
topecongiro [Fri, 26 May 2017 17:03:22 +0000 (02:03 +0900)]
Allow comments after where clause
topecongiro [Fri, 26 May 2017 08:17:12 +0000 (17:17 +0900)]
Allow default associated types
topecongiro [Fri, 26 May 2017 07:36:15 +0000 (16:36 +0900)]
Format source codes and add tests
topecongiro [Fri, 26 May 2017 07:35:34 +0000 (16:35 +0900)]
Allow macro to nested and overflowed like function call
topecongiro [Fri, 26 May 2017 07:34:58 +0000 (16:34 +0900)]
Set inside_macro to false when rewriting args of macro
Nick Cameron [Fri, 26 May 2017 05:40:23 +0000 (17:40 +1200)]
Merge pull request #1589 from topecongiro/issue-1587
Put closing paren on the next line when the last arg contains comment
topecongiro [Fri, 26 May 2017 04:14:36 +0000 (13:14 +0900)]
Put closing paren on the next line when the last arg contains comment
Nick Cameron [Thu, 25 May 2017 20:43:52 +0000 (08:43 +1200)]
Merge pull request #1586 from topecongiro/minor
Fix minor bugs
Nick Cameron [Thu, 25 May 2017 20:35:25 +0000 (08:35 +1200)]
Merge pull request #1584 from topecongiro/poor/chain-trailing-try
Enhance chain
Seiichi Uchida [Thu, 25 May 2017 14:01:41 +0000 (23:01 +0900)]
Add offset when rewriting index
Seiichi Uchida [Thu, 25 May 2017 13:55:33 +0000 (22:55 +0900)]
Update tests
Seiichi Uchida [Thu, 25 May 2017 13:55:11 +0000 (22:55 +0900)]
Be precise with one_line_budget for fn_base
topecongiro [Thu, 25 May 2017 07:30:45 +0000 (16:30 +0900)]
Add a test for #1380
topecongiro [Thu, 25 May 2017 07:08:08 +0000 (16:08 +0900)]
Format source codes
topecongiro [Thu, 25 May 2017 07:07:56 +0000 (16:07 +0900)]
Add chain_split_single_child option
topecongiro [Thu, 25 May 2017 06:47:50 +0000 (15:47 +0900)]
Allow the last elem in chain to overflow
topecongiro [Thu, 25 May 2017 04:35:09 +0000 (13:35 +0900)]
Refactoring: introduce one_line_budget
topecongiro [Thu, 25 May 2017 00:34:10 +0000 (09:34 +0900)]
Format source codes
topecongiro [Thu, 25 May 2017 00:32:14 +0000 (09:32 +0900)]
Disallow single line chain when the line exceeds the given budget
topecongiro [Thu, 25 May 2017 00:24:04 +0000 (09:24 +0900)]
Consider trailing try operations when counting almost_total
Nick Cameron [Thu, 25 May 2017 04:39:44 +0000 (16:39 +1200)]
Simplify --version info
Nick Cameron [Thu, 25 May 2017 04:23:07 +0000 (16:23 +1200)]
Remove dependency on Itertools
Nick Cameron [Thu, 25 May 2017 03:59:06 +0000 (15:59 +1200)]
Remove multimap dep
Nick Cameron [Wed, 24 May 2017 22:50:17 +0000 (10:50 +1200)]
Merge pull request #1582 from topecongiro/poor/fn_call_style_block
Decide whether args fit in a single line inside rewrite_call_args
topecongiro [Wed, 24 May 2017 21:10:00 +0000 (06:10 +0900)]
Decide whether args fit in a single line inside rewrite_call_args
Nick Cameron [Tue, 23 May 2017 23:43:10 +0000 (11:43 +1200)]
Merge pull request #1578 from topecongiro/poor/macro
Use original code snippet for macro which contains invalid syntax
topecongiro [Tue, 23 May 2017 16:18:15 +0000 (01:18 +0900)]
Return original snippet when macro contains invalid syntax
Nick Cameron [Tue, 23 May 2017 20:47:10 +0000 (08:47 +1200)]
Merge pull request #1576 from topecongiro/chain/float-first-child
Allow first child to stay on the same line with block parent when rewriting chain
topecongiro [Tue, 23 May 2017 15:07:02 +0000 (00:07 +0900)]
Format source codes
topecongiro [Tue, 23 May 2017 15:06:23 +0000 (00:06 +0900)]
Add heuristic when rewriting chain with a single child
rustfmt splits chain into multiline when the length of chain exceeds
`chain_one_line_max`. However, currenly this rule only applies when the chain
has more than one child. This can lead to unexpected long chain if the parent
is long. This commit adds heuristic that if the length of parent is longer
than the half of `chain_one_line_max` we use multiline even if there is
only a single child.
topecongiro [Tue, 23 May 2017 13:13:29 +0000 (22:13 +0900)]
Format source codes
topecongiro [Tue, 23 May 2017 13:12:52 +0000 (22:12 +0900)]
Use correct width when rewriting chain
topecongiro [Tue, 23 May 2017 13:12:37 +0000 (22:12 +0900)]
Allow first child to stay on the same line with block parent
Nick Cameron [Tue, 23 May 2017 06:35:21 +0000 (18:35 +1200)]
Merge pull request #1572 from topecongiro/nested-block
Nesting of block indented expressions
topecongiro [Tue, 23 May 2017 03:03:04 +0000 (12:03 +0900)]
Add trailing comma to a single arg in multiline
topecongiro [Tue, 23 May 2017 02:20:29 +0000 (11:20 +0900)]
Implement combining for tuple and block
topecongiro [Sun, 21 May 2017 10:56:37 +0000 (19:56 +0900)]
Update tests
topecongiro [Sun, 21 May 2017 10:56:13 +0000 (19:56 +0900)]
Implement combining openings and closings
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
topecongiro [Sun, 21 May 2017 23:50:46 +0000 (08:50 +0900)]
Update tests
topecongiro [Fri, 19 May 2017 10:31:29 +0000 (19:31 +0900)]
Format source codes
topecongiro [Fri, 19 May 2017 10:31:01 +0000 (19:31 +0900)]
Refactor source codes
topecongiro [Fri, 19 May 2017 10:30:06 +0000 (19:30 +0900)]
Allow macro rewrite to fail on rhs
topecongiro [Fri, 19 May 2017 10:28:00 +0000 (19:28 +0900)]
Fix weird indentaion in chain
topecongiro [Fri, 19 May 2017 10:25:53 +0000 (19:25 +0900)]
Implement 'vec![expr; expr]'
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
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
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
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
Ben Boeckel [Thu, 18 May 2017 12:17:09 +0000 (08:17 -0400)]
Configurations: fix typos in example signatures
Ben Boeckel [Thu, 18 May 2017 12:03:47 +0000 (08:03 -0400)]
config: fix `suffices` -> `suffixes` typo
Fixes #1477.
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
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
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`!
Flier Lu [Wed, 17 May 2017 10:32:18 +0000 (18:32 +0800)]
reorder imports in group
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.
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.
Michael Killough [Wed, 17 May 2017 10:16:35 +0000 (17:16 +0700)]
Use unreachable!() instead of panic!().
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.
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
Nick Cameron [Wed, 17 May 2017 19:59:09 +0000 (07:59 +1200)]
Bump version of strings.rs and cargo update
topecongiro [Wed, 17 May 2017 07:31:09 +0000 (16:31 +0900)]
Use multiline when signature does not fit single line
Nick Cameron [Wed, 17 May 2017 07:07:25 +0000 (19:07 +1200)]
Add note about libsyntax branch to README
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
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.
topecongiro [Tue, 16 May 2017 14:24:38 +0000 (23:24 +0900)]
Format source codes
topecongiro [Tue, 16 May 2017 14:24:00 +0000 (23:24 +0900)]
Allow last child in chain to go multiline
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.
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.
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.
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.
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
Seiichi Uchida [Mon, 15 May 2017 13:55:45 +0000 (22:55 +0900)]
Format source codes
Seiichi Uchida [Mon, 15 May 2017 13:55:01 +0000 (22:55 +0900)]
Use offset_left for rewrite_unary_prefix
Nick Cameron [Sun, 14 May 2017 21:19:18 +0000 (09:19 +1200)]
Merge pull request #1510 from fintelia/better-filelines
Better file_lines
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
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
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