Commit Graph

3070 Commits

Author SHA1 Message Date
Joshua Nelson
943b97c3ae Fix errors when parallel_compiler is enabled 2021-04-21 21:17:36 -05:00
Joshua Nelson
61ee1089f0 Use rustc_private instead of crates.io dependencies
- Update rust-toolchain to also install `rustc-dev` component
2021-04-21 21:17:36 -05:00
Caleb Cartwright
c32f2ec015 chore: fmt and cleanup 2021-04-02 23:21:06 -05:00
Caleb Cartwright
4948911608 deps: apply rustc-ap-* v712 changes 2021-04-02 23:21:06 -05:00
Caleb Cartwright
4c617e8fb3 deps: apply rustc module loading changes 2021-04-02 23:21:06 -05:00
Caleb Cartwright
a1dc57ace1 chore: apply AST HasAttrs->AstLike changes 2021-04-02 23:21:06 -05:00
Caleb Cartwright
612e8d5b9b refactor: apply rustc mod parsing changes 2021-04-02 23:21:06 -05:00
Caleb Cartwright
2c6339571b chore: apply pattern parsing changes 2021-04-02 23:21:06 -05:00
Caleb Cartwright
cbd83b8083 chore: add span creation util function 2021-04-02 23:21:06 -05:00
Yuki Okushi
ca4e9f47b9 Fix a legacy_derive_helpers warning 2021-03-18 23:34:32 -05:00
Joshua Nelson
c3a5111106 Fix some clippy warnings
This commit can be replicated with
`cargo clippy --fix -Z unstable-options && cargo +nightly-2021-02-10 fmt`.
2021-02-18 20:20:29 -06:00
David Bar-On
432e09e89f Add the use of rewrite_assign_rhs_with_comments to 1.x 2021-02-17 20:47:20 -06:00
David Bar-On
4b0ed96f2e Fix for issue 4603 about extra macro body indentation (third version) 2021-02-17 20:19:27 -06:00
Joshua Nelson
6170948820 Fix warnings
- Fix nightly warning about `format!`
- Remove unused functions and fields
2021-02-17 20:14:46 -06:00
Caleb Cartwright
9ed75111e2 deps: apply rustc-ap v705 changes to itemkind variants 2021-02-07 12:46:43 -06:00
Caleb Cartwright
58ac85b58e deps: bump rustc-ap crates to v701.0.0 2021-02-03 21:05:15 -06:00
Caleb Cartwright
b8f318c303 fix: don't insert trailing comma on struct lit rest in mac def 2021-01-28 22:01:50 -06:00
Caleb Cartwright
c13d2452c0 chore: backport some empty block check fixes 2021-01-27 20:58:42 -06:00
Caleb Cartwright
bd4dc36c4e refactor: cleanup block check for statements 2021-01-27 20:58:42 -06:00
vallentin
3e61326716 Fixed semicolon getting moved into comment (fixes #4646) 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
Ayaz Hafiz
f8deed3a3a Include const generic type bounds in their spans
Closes #4310
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
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
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
3571c5d6f7 fix: maintain redundant semis on items in statement pos 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
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
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
David Tolnay
96ee060529 Preserve polarity on negative non-trait impl 2020-11-30 23:24:36 -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
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
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
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