Commit Graph

5191 Commits

Author SHA1 Message Date
Caleb Cartwright
4c8db85939 feat: remove report_todo option 2022-05-30 08:56:09 -05:00
Caleb Cartwright
3e38399ed8 docs: clarify imports_granularity behavior with comments 2022-05-26 22:27:20 -05:00
Yacin Tmimi
73be264f9f Rephrase changelog entries to give more context 2022-05-26 21:51:07 -05:00
Yacin Tmimi
a5cfd4d145 Updated Unreleased CHANGELOG entries
from revision  v1.4.38..2d9bc460
2022-05-26 21:51:07 -05:00
Alexander Pozdneev
37b48ca4b2 Update Configurations.md
Co-authored-by: Yacin Tmimi <yacintmimi@gmail.com>
2022-05-23 09:52:20 -04:00
Alexander Pozdneev
0b6659cf02 Update Configurations.md 2022-05-23 09:52:20 -04:00
David Lattimore
95837832f4 import_granularity: Don't normalize imports with comments 2022-05-18 21:08:30 -05:00
Yacin Tmimi
b08b2daeb6 Add test for issue 3937
Closes 3937

It's unclear which change fixed the `format_code_in_doc_comments=true`
issue brought up in this issue, however I'm unable to reproduce the
error on the current master.

The added test cases should serve to prevent a regression.
2022-05-17 17:17:07 -05:00
Koichi ITO
8a4c05865b Use the traits added to the Rust 2021 Edition prelude
Follow up https://github.com/rust-lang/rust/pull/96861.

This PR uses the traits added to the Rust 2021 Edition prelude.

> The `TryInto`, `TryFrom` and `FromIterator` traits are now part of the prelude.

https://doc.rust-lang.org/edition-guide/rust-2021/prelude.html
2022-05-14 10:41:46 -05:00
Josh Triplett
17003ce66b In the docs for hex_literal_case, show the default as a possible value 2022-05-09 19:45:02 -05:00
PSeitz
84fd4cdd02 Update CHANGELOG.md 2022-05-09 11:25:17 -04:00
Pascal Seitz
c65ba14d69 Fixes #5260
Fixes #5260 by checking if it is part of a type '::'
2022-05-08 13:22:35 -05:00
Yacin Tmimi
3cc1f5ed5b Add tests for issue 4573
It's unclear which PR resolved this issue, however the behavior of
adding inline comments to the next line can't be reproduced.

These test cases should serve to prevent a regression.
2022-05-08 12:55:43 -05:00
cuishuang
c03e1842f6 fix some typos
Signed-off-by: cuishuang <imcusg@gmail.com>
2022-05-07 11:10:59 -05:00
David Tolnay
b26c86b51a Update GitHub Actions actions/checkout@v2 to v3
The v2 implementation uses Node 12, which is end-of-life on April 30, 2022.
See https://nodejs.org/en/about/releases/. Update to v3, which is based on
Node 16 whose support lasts until April 30, 2024.
2022-04-30 18:55:10 -04:00
hkalbasi
a37d3ab0e1 Memoize format_expr 2022-04-17 09:32:43 -05:00
Tom Milligan
acdab00ecc [review] check interaction with import grouping 2022-04-17 09:28:48 -05:00
Tom Milligan
9b1b3d6955 [review] rename internal function 2022-04-17 09:28:48 -05:00
Paul Gey
ba0351a146 Preserve attributes for imports_granularity=Item
Fixes #5030
2022-04-17 09:28:48 -05:00
Tom Milligan
4f3f87fb9a group_imports: test and document non-consecutive imports 2022-04-11 17:46:33 -05:00
Caleb Cartwright
2d9bc46010 Backport 4326
refactor: rename some private whitelist names
2022-04-07 17:30:50 -05:00
Expyron
91995b6142 Replace structopt dependency by clap 2022-04-07 17:24:03 -05:00
Light Ning
7d6ca7c35c
Bump deps (#5237)
* bump deps

* sort the deps
2022-04-02 10:45:38 -05:00
Tharun Rajendran
1dcdfb276d
fix(rustfmt): fix struct field formatting with doc comments present (#5217)
* fix(rustfmt): fix struct field formatting with doc comments present

Fixes #5215

* fix review feedbacks

* add unit test without doc comment

* move tests to a seperate file

* add additional test cases

* reintroduce a newline at the of test/souce/structs.rs
2022-04-01 19:00:53 -05:00
David Tolnay
5ff7b632a9 Preserve semicolon after macro call inside foreign mod 2022-03-29 22:20:11 -05:00
David Tolnay
8e94761a94 Add test of macro calls inside extern block 2022-03-29 22:20:11 -05:00
Caleb Cartwright
e0c7b7d5d3 tests: ignore cargo fmt test for rust-lang/rust runs 2022-03-28 21:33:45 -05:00
Caleb Cartwright
4fecede7fd Revert "Use cargo-fmt in self_tests"
This reverts commit c63d42e804.
2022-03-28 21:33:45 -05:00
Caleb Cartwright
63acf90044
Merge pull request #5276 from calebcartwright/subtree-sync-2022-03-27
sync subtree
2022-03-27 21:49:03 -05:00
Caleb Cartwright
c2039d95c6 chore: bump toolchain 2022-03-27 20:46:25 -05:00
Caleb Cartwright
5731f1d6e1 Merge remote-tracking branch 'upstream/master' into subtree-sync-2022-03-27 2022-03-27 20:37:09 -05:00
Yacin Tmimi
8984438a6f Honor #[rustfmt::skip::attributes(derive)] attribute
Fixes 5270

Previously, rustfmt only checked the `merge_derives` configuration value
to determine if it should merge_derives. This lead to derives being
merged even when annotated with the `rustfmt::skip` attribute.

Now, rustfmt also checks if derives are explicitly being skipped in the
current context via the `rustfmt::skip` attribute.
2022-03-21 16:56:34 -05:00
123vivekr
0dba01aee1 Add short_item_threshold config option
Allow custom short item threshold values via config
2022-03-21 16:56:09 -05:00
Yacin Tmimi
e41329ce87 Search for struct body span after any generic arguments
Fixes 5273

Previously, rustfmt searched for the start of a struct body after the
opening `{`. In most cases this works just fine, but const values can
also be defined between `{ }`, which lead to issues when rewriting the
struct body.

Now, rustfmt will search for the `{` after the generic argument list to
guarantee that the `{` it finds is the start of the struct body.
2022-03-20 21:39:12 -05:00
Camille GILLOT
4f89c51a5b Take &mut Diagnostic in emit_diagnostic.
Taking a Diagnostic by move would break the usual pattern
`diag.label(..).emit()`.
2022-03-20 20:36:08 +01:00
Caleb Cartwright
a36dc368d7
Merge pull request #5268 from calebcartwright/subtree-sync-2022-03-16
subtree sync
2022-03-17 19:08:54 -05:00
Caleb Cartwright
432b8dea64 chore: bump toolchain 2022-03-17 18:24:10 -05:00
Dylan DPC
cce0d50bcb Rollup merge of #94960 - codehorseman:master, r=oli-obk
Fix many spelling mistakes

Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-17 22:55:05 +01:00
Caleb Cartwright
c801367ecf Merge remote-tracking branch 'upstream/master' into subtree-sync-2022-03-16 2022-03-16 21:55:15 -05:00
mark
c1d351f6ee rustc_error: make ErrorReported impossible to construct
There are a few places were we have to construct it, though, and a few
places that are more invasive to change. To do this, we create a
constructor with a long obvious name.
2022-03-16 10:35:24 -05:00
codehorseman
c0861d3a9d resolve the conflict in compiler/rustc_session/src/parse.rs
Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-16 20:12:30 +08:00
Caleb Cartwright
1bb85bdf6b chore: add utility function for relative span positions 2022-03-15 22:11:16 -05:00
Yacin Tmimi
5696e38597 Add test to verify tracking issue links
Now, tracking issue links are checked against the reference number
listed in the link text to ensure they match.
2022-03-15 21:40:20 -05:00
Yacin Tmimi
9c65db61be Correct tracking issue link for skip_children
Update the issue link to point to issue 3389
2022-03-15 21:40:20 -05:00
bors
a918d8b55b Auto merge of #94584 - pnkfelix:inject-use-suggestion-sites, r=ekuber
More robust fallback for `use` suggestion

Our old way to suggest where to add `use`s would first look for pre-existing `use`s in the relevant crate/module, and if there are *no* uses, it would fallback on trying to use another item as the basis for the suggestion.

But this was fragile, as illustrated in issue #87613

This PR instead identifies span of the first token after any inner attributes, and uses *that* as the fallback for the `use` suggestion.

Fix #87613
2022-03-15 03:56:33 +00:00
Tom Milligan
b4de150dbc fix: imports_granularity module with path containing self 2022-03-12 10:47:46 -06:00
Yacin Tmimi
18c0369688 Improve mod resolution error for mods with multiple candidate files
Fixes 5167

When ``a.rs`` and ``a/mod.rs`` are both present we would emit an error
message telling the user that the module couldn't be found. However,
this behavior is misleading because we're dealing with an ambiguous
module path, not a "file not found" error.

Is the file ``a.rs`` or is it ``a/mod.rs``? Rustfmt can't decide, and
the user needs to resolve this ambiguity themselves.

Now, the error message displayed to the user is in line with what they
would see if they went to compile their code with these conflicting
module names.
2022-03-08 21:51:23 -06:00
Felix S. Klock II
003eaf8fe2 placate rustfmt in rustfmt. 2022-03-07 16:37:35 -05:00
cassaundra
58de4142c5 Add test for issue #4791 2022-03-06 11:23:50 -06:00
cassaundra
ab9f2a8ac7 Add more tests for struct_field_align_threshold and trailing_comma 2022-03-06 11:23:50 -06:00