]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoComment between typebounds (#4474)
WhizSid [Sun, 18 Oct 2020 17:02:46 +0000 (22:32 +0530)]
Comment between typebounds (#4474)

* Test cases and get spans

* Fixed type bounds

* Fixed issue of test cases

* Fixed first test case issue

* Removed unwanted whitespaces

* Removed tmp files

3 years agofix: backport some imports for cherry-picked commit
Caleb Cartwright [Sun, 29 Nov 2020 00:30:28 +0000 (18:30 -0600)]
fix: backport some imports for cherry-picked commit

3 years agoFixed comment dropped between & and type issue (#4482)
WhizSid [Tue, 3 Nov 2020 03:44:15 +0000 (09:14 +0530)]
Fixed comment dropped between & and type issue (#4482)

* Fixed comment dropped between & and type issue

* Reduced nesting levels and avoided duplications

* Removed extra allocations

3 years agoFixed 'Comment removed between type name and =' issue (#4448)
WhizSid [Fri, 9 Oct 2020 00:27:04 +0000 (05:57 +0530)]
Fixed 'Comment removed between type name and =' issue (#4448)

* Fixed Comment removed between type name and = issue

* Fixed where clause issue and pass the full span

* has_where condition inline

* Fixed indentation error on where clause

* Removed tmp file

3 years agofix: apply rustc-ap updates to backported commit
Caleb Cartwright [Sun, 29 Nov 2020 00:23:00 +0000 (18:23 -0600)]
fix: apply rustc-ap updates to backported commit

3 years agoPick up comments between visibility modifier and item name (#4239)
hafiz [Mon, 8 Jun 2020 01:31:24 +0000 (20:31 -0500)]
Pick up comments between visibility modifier and item name (#4239)

* Pick up comments between visibility modifier and item name

I don't think this hurts to fix. #2781, which surfaced this issue, has
a number of comments relating to similar but slightly different issues
(i.e. dropped comments in other places). I can mark #2781 as closed and
then will open new issues for the comments that are not already resolved
or tracked.

Closes #2781

* fixup! Pick up comments between visibility modifier and item name

* fixup! Pick up comments between visibility modifier and item name

3 years agotests: backport an additional test case
Caleb Cartwright [Sun, 29 Nov 2020 00:03:48 +0000 (18:03 -0600)]
tests: backport an additional test case

3 years agotests
Adam H. Leventhal [Wed, 22 Apr 2020 05:54:08 +0000 (22:54 -0700)]
tests

3 years agofixes #4115, #4029, #3898
Adam H. Leventhal [Wed, 22 Apr 2020 05:57:54 +0000 (22:57 -0700)]
fixes #4115, #4029, #3898

3 years agoCompare code block line indentation with config whitespace (#4166)
hafiz [Sun, 10 May 2020 11:54:46 +0000 (06:54 -0500)]
Compare code block line indentation with config whitespace (#4166)

Previously the indetation of a line was compared with the configured
number of spaces per tab, which could cause lines that were formatted
with hard tabs not to be recognized as indented ("\t".len() < "    ".len()).

Closes #4152

3 years agoRemove `async fn` from extern block tests
David Tolnay [Sun, 29 Nov 2020 02:47:32 +0000 (18:47 -0800)]
Remove `async fn` from extern block tests

3 years agoDon't drop blocks on foreign functions
Ayaz Hafiz [Fri, 10 Jul 2020 02:56:46 +0000 (19:56 -0700)]
Don't drop blocks on foreign functions

A code like

```rust
extern "C" {
    fn f() {
        fn g() {}
    }
}
```

is incorrect and does not compile. Today rustfmt formats this in a way
that is correct:

```rust
extern "C" {
    fn f();
}
```

But this loses information, and doesn't have to be done because we know
the content of the block if it is present. During development I don't
think rustfmt should drop the block in this context.

Closes #4313

3 years agoProperly format function signature in extern blocks
Ayaz Hafiz [Tue, 30 Jun 2020 02:36:31 +0000 (19:36 -0700)]
Properly format function signature in extern blocks

Closes #4288

And we get to drop a method, which I think is a win :)

3 years agoAdd a test
topecongiro [Tue, 30 Jun 2020 02:34:05 +0000 (11:34 +0900)]
Add a test

3 years agochore: run rustfmt against source
Caleb Cartwright [Sat, 28 Nov 2020 21:03:06 +0000 (15:03 -0600)]
chore: run rustfmt against source

3 years agofeat: support underscore expressions
Caleb Cartwright [Sat, 28 Nov 2020 03:18:39 +0000 (21:18 -0600)]
feat: support underscore expressions

3 years agorefactor: update cfg_if attr parsing
Caleb Cartwright [Sat, 28 Nov 2020 03:30:27 +0000 (21:30 -0600)]
refactor: update cfg_if attr parsing

3 years agofeat: support struct/slice destructuring
Caleb Cartwright [Sat, 28 Nov 2020 03:09:33 +0000 (21:09 -0600)]
feat: support struct/slice destructuring

3 years agodeps: minor rustc_ast changes for v691
Caleb Cartwright [Sat, 28 Nov 2020 20:58:10 +0000 (14:58 -0600)]
deps: minor rustc_ast changes for v691

3 years agodeps: bump rustc-ap crates to v691
Caleb Cartwright [Sat, 28 Nov 2020 20:54:03 +0000 (14:54 -0600)]
deps: bump rustc-ap crates to v691

3 years agodeps: bump rustc-ap to v687
Caleb Cartwright [Sat, 21 Nov 2020 01:06:23 +0000 (19:06 -0600)]
deps: bump rustc-ap to v687

3 years agofix: don't force a newline after an empty where clause
meiomorphism [Wed, 25 Nov 2020 12:31:10 +0000 (04:31 -0800)]
fix: don't force a newline after an empty where clause

Fixes #4547.

3 years agoOption to create groups for std, external crates, and other imports
Matt [Mon, 16 Nov 2020 23:24:03 +0000 (18:24 -0500)]
Option to create groups for std, external crates, and other imports

Backport of 17d90ca.

3 years agometa: bump to v1.4.27
Caleb Cartwright [Mon, 16 Nov 2020 19:25:02 +0000 (13:25 -0600)]
meta: bump to v1.4.27

3 years agoci: update GHA workflows
Caleb Cartwright [Mon, 16 Nov 2020 19:24:51 +0000 (13:24 -0600)]
ci: update GHA workflows

3 years agofix: don't drop leading comments in extern
Caleb Cartwright [Mon, 16 Nov 2020 18:39:26 +0000 (12:39 -0600)]
fix: don't drop leading comments in extern

3 years agometa: bump version to v1.4.26
Caleb Cartwright [Sat, 14 Nov 2020 04:33:57 +0000 (22:33 -0600)]
meta: bump version to v1.4.26

3 years agoci: restrict GHA workflow triggers on push
Caleb Cartwright [Sat, 14 Nov 2020 04:17:07 +0000 (22:17 -0600)]
ci: restrict GHA workflow triggers on push

3 years agotests: attributed comment-only blocks
Caleb Cartwright [Sat, 14 Nov 2020 03:42:37 +0000 (21:42 -0600)]
tests: attributed comment-only blocks

3 years agoFixed 'Incorrect comment indent inside if/else' issue. (#4459)
WhizSid [Thu, 15 Oct 2020 02:08:58 +0000 (07:38 +0530)]
Fixed 'Incorrect comment indent inside if/else' issue. (#4459)

* Added test cases

* Fixed if condition comment issue

* Fixed extern C issue

* Removed previous test case

* Removed tmp file

* honor the authors intent

* Changed the file name to its original name

* Removed extra whitespace

3 years agoCorrectly create artificial span for formatting closure body
Ayaz Hafiz [Sat, 15 Aug 2020 20:34:06 +0000 (13:34 -0700)]
Correctly create artificial span for formatting closure body

This commit partially reverts #3934, opting to create a span that covers
the entire body of a closure when formatting a closure body with a
block-formatting strategy, rather than having the block-formatting code
determine if the visitor pointer should be rewound. The problem with
rewinding the visitor pointer is it may be incorrect for other (i.e.
non-artificial) AST nodes, as in the case of #4382.

Closes #4382

3 years agofixup! Correctly create artificial span for formatting closure body
Ayaz Hafiz [Sat, 15 Aug 2020 20:38:06 +0000 (13:38 -0700)]
fixup! Correctly create artificial span for formatting closure body

3 years agometa: release v1.4.25
Caleb Cartwright [Wed, 11 Nov 2020 02:18:22 +0000 (20:18 -0600)]
meta: release v1.4.25

3 years agofeat: don't insert semi in macro_rules arm body
Caleb Cartwright [Wed, 11 Nov 2020 02:07:42 +0000 (20:07 -0600)]
feat: don't insert semi in macro_rules arm body

3 years agometa: release v1.4.24
Caleb Cartwright [Fri, 6 Nov 2020 01:45:56 +0000 (19:45 -0600)]
meta: release v1.4.24

3 years agofix: remove ignored depr attribute which now errors
Caleb Cartwright [Fri, 6 Nov 2020 01:30:56 +0000 (19:30 -0600)]
fix: remove ignored depr attribute which now errors

3 years agofix: remove comment from cherry-pick that v1.x doesn't handle
Caleb Cartwright [Fri, 6 Nov 2020 01:24:51 +0000 (19:24 -0600)]
fix: remove comment from cherry-pick that v1.x doesn't handle

3 years agoDon't flatten a block containing a single macro call
Aaron Hill [Tue, 27 Oct 2020 22:52:02 +0000 (18:52 -0400)]
Don't flatten a block containing a single macro call

We no longer flatten a block that looks like this:

```rust
match val {
    pat => { macro_call!() }
}
```

Currently, rust ignores trailing semicolons in macro expansion in
expression position (see https://github.com/rust-lang/rust/issues/33953)

If this is changed, flattening a block with a macro call may break the
user's code - the trailing semicolon will no longer parse if the macro
call occurs immediately on the right-hand side of the match arm
(e.g. `pat => macro_call!()`)

3 years agometa: bump rustfmt version to 1.4.23
Caleb Cartwright [Fri, 30 Oct 2020 05:37:08 +0000 (00:37 -0500)]
meta: bump rustfmt version to 1.4.23

3 years agoci: fix asset upload workflow
Caleb Cartwright [Fri, 30 Oct 2020 05:20:23 +0000 (00:20 -0500)]
ci: fix asset upload workflow

3 years agofeat: v2 support for nested tuples w/o spaces
Caleb Cartwright [Fri, 30 Oct 2020 05:03:03 +0000 (00:03 -0500)]
feat: v2 support for nested tuples w/o spaces

3 years agoAdd some basic tests for `try{}` expressions
Scott McMurray [Tue, 13 Oct 2020 04:43:04 +0000 (21:43 -0700)]
Add some basic tests for `try{}` expressions

They failed to parse in rustfmt on me in https://github.com/rust-lang/rust/pull/77877, which looks like it's since been fixed, but I figured I'd send in some tests anyway.

3 years agotests: adjust some cherry-picekd tests
Caleb Cartwright [Fri, 30 Oct 2020 03:59:45 +0000 (22:59 -0500)]
tests: adjust some cherry-picekd tests

3 years agofix: resolve some parser related bugs
Caleb Cartwright [Sat, 26 Sep 2020 05:00:49 +0000 (00:00 -0500)]
fix: resolve some parser related bugs

3 years agotests: add test for panic on new_parser_from_file
Caleb Cartwright [Sat, 26 Sep 2020 05:01:21 +0000 (00:01 -0500)]
tests: add test for panic on new_parser_from_file

3 years agofix(parser): better unclosed delims handling
Caleb Cartwright [Fri, 30 Oct 2020 03:50:25 +0000 (22:50 -0500)]
fix(parser): better unclosed delims handling

3 years agodeps: bump rustc-ap to v686
Caleb Cartwright [Wed, 28 Oct 2020 01:58:52 +0000 (20:58 -0500)]
deps: bump rustc-ap to v686

3 years agoFix overriding license header bug (#4488)
Michael Müller [Sat, 24 Oct 2020 16:14:52 +0000 (18:14 +0200)]
Fix overriding license header bug (#4488)

* Override header to None when path len = 0

* Add regression test

* Ensure nightly

3 years agoPreserve comments in empty statements (#4180)
hafiz [Wed, 20 May 2020 15:39:34 +0000 (10:39 -0500)]
Preserve comments in empty statements (#4180)

* Preserve comments in empty statements

Closes #4018

* fixup! Preserve comments in empty statements

3 years agoCorrectly indent skipped-over code
Ayaz Hafiz [Wed, 26 Aug 2020 04:52:26 +0000 (23:52 -0500)]
Correctly indent skipped-over code

Closes #4398

3 years agodeps: bump rustc-ap to v684
Caleb Cartwright [Sat, 24 Oct 2020 04:10:14 +0000 (23:10 -0500)]
deps: bump rustc-ap to v684

3 years agofeat: add initial support for ConstBlock expressions
Caleb Cartwright [Tue, 20 Oct 2020 01:26:56 +0000 (20:26 -0500)]
feat: add initial support for ConstBlock expressions

3 years agodeps: update macro parsing
Caleb Cartwright [Tue, 20 Oct 2020 01:26:36 +0000 (20:26 -0500)]
deps: update macro parsing

3 years agodeps: bump rustc-ap to v683
Caleb Cartwright [Sat, 24 Oct 2020 04:00:13 +0000 (23:00 -0500)]
deps: bump rustc-ap to v683

3 years agoRelease v1.4.22
Caleb Cartwright [Sun, 4 Oct 2020 17:09:54 +0000 (12:09 -0500)]
Release v1.4.22

3 years agorefactor: move env/osstr imports to avoid warnings
Caleb Cartwright [Sun, 4 Oct 2020 17:06:43 +0000 (12:06 -0500)]
refactor: move env/osstr imports to avoid warnings

3 years agoUse rustfmt given by RUSTFMT env var (#4419)
David Tolnay [Wed, 16 Sep 2020 14:09:10 +0000 (07:09 -0700)]
Use rustfmt given by RUSTFMT env var (#4419)

3 years agofixup! Preserve and format type aliases in extern blocks
Ayaz Hafiz [Sun, 10 May 2020 17:11:36 +0000 (10:11 -0700)]
fixup! Preserve and format type aliases in extern blocks

3 years agofixup! Preserve and format type aliases in extern blocks
Ayaz Hafiz [Sun, 10 May 2020 17:06:23 +0000 (10:06 -0700)]
fixup! Preserve and format type aliases in extern blocks

3 years agofixup! Preserve and format type aliases in extern blocks
Ayaz Hafiz [Sat, 9 May 2020 23:01:42 +0000 (16:01 -0700)]
fixup! Preserve and format type aliases in extern blocks

3 years agoPreserve and format type aliases in extern blocks
Ayaz Hafiz [Sat, 9 May 2020 22:19:48 +0000 (15:19 -0700)]
Preserve and format type aliases in extern blocks

Previously, non-trivial type aliases in extern blocks were dropped by
rustfmt because only the type alias name would be passed to a rewritter.
This commit fixes that by passing all type information (generics,
bounds, and assignments) to a type alias rewritter, and consolidates
`rewrite_type_alias` and `rewrite_associated_type` as one function.

3 years agoci: backport GHA workflows
Caleb Cartwright [Thu, 24 Sep 2020 03:22:37 +0000 (22:22 -0500)]
ci: backport GHA workflows

3 years agofeat: support config. of leading match arm pipe
Caleb Cartwright [Thu, 24 Sep 2020 03:19:11 +0000 (22:19 -0500)]
feat: support config. of leading match arm pipe

3 years agodocs: add config info for match_arm_leading_pipes
Caleb Cartwright [Thu, 24 Sep 2020 03:05:56 +0000 (22:05 -0500)]
docs: add config info for match_arm_leading_pipes

3 years agotests: add tests for leading pipe config
Caleb Cartwright [Thu, 24 Sep 2020 03:05:31 +0000 (22:05 -0500)]
tests: add tests for leading pipe config

3 years agoAdd regression test for unsafe mods
David Tolnay [Wed, 23 Sep 2020 04:24:23 +0000 (00:24 -0400)]
Add regression test for unsafe mods

3 years agodeps: bump rustc-ap to v679
David Tolnay [Wed, 23 Sep 2020 02:22:38 +0000 (22:22 -0400)]
deps: bump rustc-ap to v679

3 years agodeps: bump rustc-ap to v678
Caleb Cartwright [Wed, 16 Sep 2020 13:37:14 +0000 (08:37 -0500)]
deps: bump rustc-ap to v678

3 years agobump rustfmt version to v1.4.21
Caleb Cartwright [Fri, 4 Sep 2020 21:46:45 +0000 (16:46 -0500)]
bump rustfmt version to v1.4.21

3 years agofix: inner attribute formatting
Caleb Cartwright [Wed, 2 Sep 2020 23:42:00 +0000 (18:42 -0500)]
fix: inner attribute formatting

3 years agoFix module resolution in inner modules with paths (#4194)
mahkoh [Fri, 22 May 2020 09:55:34 +0000 (11:55 +0200)]
Fix module resolution in inner modules with paths (#4194)

3 years agochore: run rustfmt
Caleb Cartwright [Wed, 2 Sep 2020 17:59:58 +0000 (12:59 -0500)]
chore: run rustfmt

3 years agodeps: bump rustc-ap to v677
Caleb Cartwright [Wed, 2 Sep 2020 17:58:18 +0000 (12:58 -0500)]
deps: bump rustc-ap to v677

3 years agodeps: bump rustc-ap to v673
Caleb Cartwright [Wed, 2 Sep 2020 17:36:50 +0000 (12:36 -0500)]
deps: bump rustc-ap to v673

3 years agodeps: bump rustc-ap to v672
Caleb Cartwright [Wed, 2 Sep 2020 15:14:23 +0000 (10:14 -0500)]
deps: bump rustc-ap to v672

3 years agotests: add system tests for inverted span issue
Caleb Cartwright [Sun, 9 Aug 2020 19:00:26 +0000 (14:00 -0500)]
tests: add system tests for inverted span issue

3 years agofix: inverted span on attrs within closure
Caleb Cartwright [Sun, 9 Aug 2020 18:59:52 +0000 (13:59 -0500)]
fix: inverted span on attrs within closure

3 years agodeps: bump rustc-ap to v671 (#4356)
Caleb Cartwright [Fri, 7 Aug 2020 00:22:20 +0000 (19:22 -0500)]
deps: bump rustc-ap to v671 (#4356)

4 years agopreparation for potential rustfmt 1.4.19 (#4283)
Seiichi Uchida [Tue, 21 Jul 2020 02:51:49 +0000 (11:51 +0900)]
preparation for potential rustfmt 1.4.19 (#4283)

4 years agochore: backport 8157a3f0afe978d3e953420577f8344db7e905bf
Caleb Cartwright [Wed, 15 Jul 2020 14:19:21 +0000 (09:19 -0500)]
chore: backport 8157a3f0afe978d3e953420577f8344db7e905bf

4 years agodeps: bump rustc-ap to v669
Caleb Cartwright [Wed, 15 Jul 2020 02:36:24 +0000 (21:36 -0500)]
deps: bump rustc-ap to v669

4 years agodeps: bump rustc-ap-* to v668
Caleb Cartwright [Fri, 10 Jul 2020 04:15:08 +0000 (23:15 -0500)]
deps: bump rustc-ap-* to v668

4 years agodeps: bump rustc-ap* to v666
Caleb Cartwright [Sat, 27 Jun 2020 18:15:54 +0000 (13:15 -0500)]
deps: bump rustc-ap* to v666

4 years agoUse correct span for match arms with the leading pipe and attributes (#3975)
Seiichi Uchida [Sat, 21 Dec 2019 15:31:59 +0000 (00:31 +0900)]
Use correct span for match arms with the leading pipe and attributes (#3975)

4 years agoRelease v1.4.18
topecongiro [Sat, 13 Jun 2020 00:46:28 +0000 (09:46 +0900)]
Release v1.4.18

4 years agoMerge pull request #4253 from calebcartwright/rustfmt-1.4.18
Seiichi Uchida [Sat, 13 Jun 2020 00:28:25 +0000 (09:28 +0900)]
Merge pull request #4253 from calebcartwright/rustfmt-1.4.18

bump rustfmt 1.x rustc-ap* crates to v644

4 years agofix: backport fix for #4079
Caleb Cartwright [Fri, 12 Jun 2020 04:29:51 +0000 (23:29 -0500)]
fix: backport fix for #4079

4 years agofix: backport fix for #4020
Caleb Cartwright [Fri, 12 Jun 2020 04:17:38 +0000 (23:17 -0500)]
fix: backport fix for #4020

4 years agodeps: bump structopt (and proc-macro-error)
Caleb Cartwright [Fri, 12 Jun 2020 04:05:46 +0000 (23:05 -0500)]
deps: bump structopt (and proc-macro-error)

4 years agofix: backport fix for submod parser errors
Caleb Cartwright [Fri, 12 Jun 2020 02:49:40 +0000 (21:49 -0500)]
fix: backport fix for submod parser errors

4 years agofix: backport mod resolution error handling
Caleb Cartwright [Fri, 12 Jun 2020 02:11:18 +0000 (21:11 -0500)]
fix: backport mod resolution error handling

4 years agoSwitch to std::error::Error for errors (#3948)
David Tolnay [Tue, 3 Dec 2019 00:20:17 +0000 (16:20 -0800)]
Switch to std::error::Error for errors (#3948)

4 years agodeps: apply upstream rustc-* changes
Caleb Cartwright [Thu, 11 Jun 2020 18:22:37 +0000 (13:22 -0500)]
deps: apply upstream rustc-* changes

4 years agodeps: bump rustc-ap* to v664
Caleb Cartwright [Thu, 11 Jun 2020 18:21:55 +0000 (13:21 -0500)]
deps: bump rustc-ap* to v664

4 years agoRelease v1.4.17
topecongiro [Mon, 8 Jun 2020 01:48:46 +0000 (10:48 +0900)]
Release v1.4.17

4 years agoBump parking_lot
topecongiro [Mon, 8 Jun 2020 01:46:38 +0000 (10:46 +0900)]
Bump parking_lot

4 years agoSupport module-level rustfmt::skip in sub-modules
topecongiro [Mon, 8 Jun 2020 01:31:25 +0000 (10:31 +0900)]
Support module-level rustfmt::skip in sub-modules

4 years agoRelease v1.4.15
topecongiro [Tue, 19 May 2020 08:30:50 +0000 (17:30 +0900)]
Release v1.4.15

4 years agoCargo update
topecongiro [Tue, 19 May 2020 08:32:51 +0000 (17:32 +0900)]
Cargo update

4 years agoUpdate rustc-ap-* crates to 659.0.0 for rustfmt-1.4.15 (#4184)
Seiichi Uchida [Tue, 19 May 2020 08:31:28 +0000 (17:31 +0900)]
Update rustc-ap-* crates to 659.0.0 for rustfmt-1.4.15 (#4184)