Commit Graph

4959 Commits

Author SHA1 Message Date
vallentin
1e2b0b7c72 Added 4646 test case 2021-01-27 20:58:42 -06:00
Michael Morgan
384ba68d64 Add imports_granularity="Item".
This option splits all imports into their own `use` statement.
2021-01-27 20:58:42 -06:00
Sean Klein
5e14f760c5 fix: Avoid incorrect global 'cfg_if' Symbol interning
Fixes #4656
2021-01-27 19:26:58 -06:00
Caleb Cartwright
110271469a chore: update Changelog with const generic backports 2021-01-27 18:50:03 -06:00
Ayaz Hafiz
f8deed3a3a Include const generic type bounds in their spans
Closes #4310
2021-01-27 18:50:03 -06:00
topecongiro
152ccb5059 Do not duplicate const keyword on parameters 2021-01-27 18:50:03 -06:00
Seiichi Uchida
c0fede355c Use the span after generics and where clause (#4208) 2021-01-27 18:50:03 -06:00
hafiz
269584634a Include constness in impl blocks (#4215)
Closes #4084
2021-01-27 18:50:03 -06:00
Geoffry Song
17bad2b3c0 Tweak imports_granularity documentation 2021-01-17 11:48:47 -06:00
Geoffry Song
0d60a616ab Disable deprecated_option_merge_imports tests on non-nightly 2021-01-17 11:48:47 -06:00
Geoffry Song
71863753bd Rename merge_imports to imports_granularity and add a Module option.
This renames the existing `true`/`false` options to `Crate`/`Never`, then adds a
new `Module` option which causes imports to be grouped together by their
originating module.
2021-01-17 11:48:47 -06:00
Caleb Cartwright
216a643005 meta: bump version v1.4.32 2021-01-16 11:17:23 -06:00
Caleb Cartwright
590f6a10ca meta: update license years 2021-01-16 11:17:23 -06:00
Caleb Cartwright
c4d551cdf5 refactor: remove unneeded clone 2021-01-16 11:17:23 -06:00
Caleb Cartwright
b30cb24286 fix: indentation issue on generic bounds 2021-01-16 11:17:23 -06:00
Caleb Cartwright
4f9c794ce1 meta: bump to v1.4.31 2021-01-09 12:45:43 -06:00
Caleb Cartwright
b57469d16e ci: add mingw to path for asset upload job 2021-01-09 12:45:08 -06:00
Caleb Cartwright
3571c5d6f7 fix: maintain redundant semis on items in statement pos 2021-01-09 12:11:52 -06:00
Mara Bos
c59b147d67 Update Cargo.lock. 2021-01-09 12:11:52 -06:00
Mara Bos
f0eaaeda9e Add 2021 test. 2021-01-09 12:11:52 -06:00
Mara Bos
b623eb324c Fix expected macro formatting test output. 2021-01-09 12:11:52 -06:00
Mara Bos
5bb17a0d36 Account for new ast::GenericParamKind::Const::default in rust_ast. 2021-01-09 12:11:52 -06:00
Mara Bos
a6b0c18dc9 Bump rustc-ap to v697. 2021-01-09 12:11:52 -06:00
Mara Bos
4644418556 Fixes for new rustc changes. 2021-01-09 12:11:52 -06:00
Mara Bos
398d2f96c3 Add support for edition 2021. 2021-01-09 12:11:52 -06:00
Caleb Cartwright
d8e0d00377 ci: fix linking issue on windows gnu jobs 2021-01-09 12:11:52 -06:00
Caleb Cartwright
acd94866fd meta: bump to v1.4.30 2020-12-20 12:05:05 -06:00
Seiichi Uchida
0d022d08d8 Format error and typeof types (#4416)
* Add a test for #4357

* Format error and typeof types
2020-12-20 12:05:05 -06:00
Stéphane Campinas
c536d80dc1 Fix rewrite of closures with a return type
If the closure's body fits in a line, the block is removed but it is
necessary if the closure has a return type.
2020-12-20 12:05:05 -06:00
Caleb Cartwright
4cfb9ef8f4 fix: don't strip nonexistent comma in derive 2020-12-20 12:05:05 -06:00
Caleb Cartwright
70ce18255f meta: bump to v1.4.29 2020-12-04 22:27:48 -06:00
David Tolnay
c40a8c1ecc Add negative impl test 2020-11-30 23:24:36 -06:00
David Tolnay
96ee060529 Preserve polarity on negative non-trait impl 2020-11-30 23:24:36 -06:00
Caleb Cartwright
29f33eb7d6 meta: bump to v1.4.28 2020-11-29 13:26:58 -06:00
WhizSid
7d9ee7558e 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
2020-11-29 13:26:58 -06:00
Caleb Cartwright
823c4f820a fix: backport some imports for cherry-picked commit 2020-11-29 13:26:58 -06:00
WhizSid
b7c38c9d50 Fixed comment dropped between & and type issue (#4482)
* Fixed comment dropped between & and type issue

* Reduced nesting levels and avoided duplications

* Removed extra allocations
2020-11-29 13:26:58 -06:00
WhizSid
6455e9de0e 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
2020-11-29 13:26:58 -06:00
Caleb Cartwright
ea712f1a2c fix: apply rustc-ap updates to backported commit 2020-11-29 13:26:58 -06:00
hafiz
5e7fb45533 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
2020-11-29 13:26:58 -06:00
Caleb Cartwright
fb7e604538 tests: backport an additional test case 2020-11-29 13:26:58 -06:00
Adam H. Leventhal
c7359945a4 tests 2020-11-29 13:26:58 -06:00
Adam H. Leventhal
3df383aa3c fixes #4115, #4029, #3898 2020-11-29 13:26:58 -06:00
hafiz
c77c6a405d 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
2020-11-29 13:26:58 -06:00
David Tolnay
e7ecdc1664 Remove async fn from extern block tests 2020-11-28 21:59:30 -06:00
Ayaz Hafiz
3bf67c175d 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
2020-11-28 21:59:30 -06:00
Ayaz Hafiz
5ffccbb627 Properly format function signature in extern blocks
Closes #4288

And we get to drop a method, which I think is a win :)
2020-11-28 21:59:30 -06:00
topecongiro
8e46225547 Add a test 2020-11-28 21:59:30 -06:00
Caleb Cartwright
48d30a4f71 chore: run rustfmt against source 2020-11-28 17:41:21 -06:00
Caleb Cartwright
4d9fa00fd5 feat: support underscore expressions 2020-11-28 17:41:21 -06:00