Commit Graph

789 Commits

Author SHA1 Message Date
Yacin Tmimi
348a499e8b Merge remote-tracking branch 'upstream/master' into subtree-push-nightly-2024-09-10 2024-09-10 01:15:02 -04:00
ding-young
b40c3cc388 impl rewrite_result for ForeignItem 2024-09-05 02:02:40 -04:00
ding-young
2639370905 impl rewrite_result for TraitAliasBounds, WherePredicate 2024-09-05 02:02:40 -04:00
Yacin Tmimi
ae59ee755a sort rustfmt imports
The version-sort algorithm makes changes to the sort order of imports,
and we're updating them here for the self tests.
2024-09-03 15:21:36 -04:00
ding-young
35b3889c77 impl rewrite_result for ControlFlow, Stmt, update rewrite_index 2024-09-01 10:15:00 -04:00
ding-young
193051438d update rewrite_assignment to return RewriteResult 2024-09-01 09:07:21 -04:00
Nicholas Nethercote
c3beb05687 Remove #[macro_use] extern crate tracing from rustfmt. 2024-08-30 13:35:05 +10:00
ding-young
6f5e99b7b5 update macro rewrite functions to return RewriteResult 2024-08-25 09:23:04 -04:00
ding-young
3d468e2d92 update combine_strs_with_missing_comments 2024-08-03 04:43:03 -06:00
Caleb Cartwright
7c41e2bfba refactor: switch from 'version' to 'style_edition'
Updates the relevant formatting logic to utilize the
new 'style_edition' option directly instead of the now
deprecated 'version' option. 'version' has only been
soft deprecated and has auto mapping in place so there
should be zero formatting impact to current 'version' users.
2024-07-28 19:37:36 -05:00
ding-young
e21c1e220b refactor rewrite_array, pair, tuple, call 2024-07-26 03:53:21 -06:00
ding-young
1313d61842 modfiy ListItem to hold RewriteResult as the item field 2024-07-26 03:00:49 -06:00
ding-young
6ccf539b19 modify trait bound of itemize_list 2024-07-26 03:00:49 -06:00
ding-young
bb56224d2a refactor rewrite_block 2024-07-15 14:34:56 -06:00
ding-young
21afdb81f8 add Ext trait for converting Option->RewriteResult 2024-07-03 19:10:20 -06:00
ding-young
905ca5483b add rewrite_result method to Rewrite trait
impl rewrite_result for ast::Local, ast::FieldDef, ast::Param, ast::FnRetTy
2024-07-03 19:10:20 -06:00
Michael Goulet
c5284965bd Remove stray println from rustfmt 2024-06-25 18:05:52 -04:00
Michael Goulet
22aac496cc Remove stray println from rustfmt 2024-06-23 22:27:41 -04:00
Caleb Cartwright
ebce054347 Merge commit 'e4944185ae09c99f59b460e358909f329010ea9c' into sync-from-rustfmt-24-06 2024-06-22 15:33:45 -05:00
Yacin Tmimi
30cdc2b3e9 format safety keywords on static items
This includes both `ast::StaticItem` and `ast::StaticForeignItem`.
`safety` was added to both `ast::StaticItem` and `ast::SaticForeignItem`
in https://github.com/rust-lang/rust/pull/124482.
2024-06-21 09:11:07 -05:00
Yacin Tmimi
76cd550c54 Merge remote-tracking branch 'upstream/master' into subtree-push-nightly-2024-06-13 2024-06-12 22:37:39 -04:00
Santiago Pastorino
97bdbd96f1 Rename Unsafe to Safety 2024-05-17 18:33:37 -03:00
Vadim Petrochenkov
05a2db7624 delegation: Implement list delegation
```rust
reuse prefix::{a, b, c}
```
2024-05-15 02:32:59 +03:00
Santiago Pastorino
fafa690716 Add StaticForeignItem and use it on ForeignItemKind 2024-04-29 13:15:51 -03:00
León Orell Valerian Liehr
fc64cbdbe7 AST: Refactor type alias where clauses 2024-02-29 17:18:40 +01:00
Jules Bertholet
5805040d28
Search span using *unnormalized* ident (#6073)
Fixes 6069

Calling `item.ident.as_str()` returns an NFC normalized ident, which
might not be what's written in the source code. To avoid panics when
calling `snippet_provider.span_after` use the ident from the source.
2024-02-14 14:40:55 -05:00
Josh Soref
cedb7b5058
Spelling (#5753)
various spelling fixes
---------

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2024-01-25 18:55:23 -05:00
Bryanskiy
6078b96b23 Delegation implementation: step 1 2024-01-12 14:11:16 +03:00
IVIURRAY
6356fca675
Prevent enum variant attributes from wrapping one character early
Fixes 5801 when using `version=Two`

Previously, doc comments would wrap one character less than the
`comment_width` when using `wrap_comments=true`, and fn-like attributes
would wrap one character before the `attr_fn_like_width`.

Now, when using `version=Two` enum variant attributes won't wrap early
2024-01-08 10:06:25 -05:00
Yacin Tmimi
6cc513f5e5 Merge remote-tracking branch 'origin/master' into subtree_sync_with_1.77.0_nightly_2023_12_27 2023-12-28 16:50:17 -05:00
Alona Enraght-Moony
df30a7a2e4 Give VariantData::Struct named fields, to clairfy recovered. 2023-12-20 00:07:34 +00:00
Yacin Tmimi
227e361187 Merge remote-tracking branch 'upstream/master' into subtree_push_2023_12_12 2023-12-12 11:45:27 -05:00
Michael Goulet
6ebb66cea9 coro_kind -> coroutine_kind 2023-12-08 17:23:25 +00:00
Eric Holk
13d284d177 Option<CoroutineKind> 2023-12-04 13:03:37 -08:00
Eric Holk
97fdae1034 Merge Async and Gen into CoroutineKind 2023-12-04 12:48:01 -08:00
GambitingMan
8d2c4157e6 Fixes comma added to comment in where-clause 2023-11-01 20:21:05 -05:00
Caleb Cartwright
04bd7201a9 Merge commit '81fe905ca83cffe84322f27ca43950b617861ff7' into rustfmt-sync 2023-10-22 20:21:44 -05:00
Caleb Cartwright
f35f25287f Merge remote-tracking branch 'upstream/master' into subtree-sync-2023-10-22 2023-10-22 12:45:06 -05:00
Caleb Cartwright
2707103154 fix: adjust span derivation for const generics 2023-10-08 19:55:04 -04:00
Michael Goulet
f867858755 Fix spans for comments in rustfmt 2023-10-04 21:09:54 +00:00
Michael Goulet
8ac561afef Fix spans for comments in rustfmt 2023-10-04 21:09:54 +00:00
Linda_pp
262feb3337
Fix checking if newline is needed before else in let-else statement
Fixes 5901

Take leading attributes and comments into consideration when determining if we need to wrap the `else` keyword onto the next line.
2023-09-08 21:05:07 -04:00
Kevin Ji
a57d57b16a Remove newlines in where clauses for v2
Fixes #5655.
2023-08-16 12:34:21 -04:00
fee1-dead
4b01e62943
refactor ABI formatting (#5845)
fixes 5701

Whenever we see an `extern "Rust"` on a function, we don't strip it from the function.

If there's any future desire to have rustfmt remove an explicit "Rust" ABI, as it historically did prior to this change, then we can consider updating the rustfmt config surface to support that scenario
2023-08-14 08:19:23 -04:00
Yuri Astrakhan
b069aac44d
Inline format arguments for easier reading (#5881)
* Inline format arguments for easier reading

Code becomes shorter and often easier to read when format args are inlined.  Note that I skipped the mixed cases to make it more straightforward (could be done separatelly).

Also, there are two FIXME comments - for some reasons inlining makes format string exceed 100 char line width and crash.

```
cargo clippy --workspace --allow-dirty --fix --benches --tests --bins -- -A clippy::all -W clippy::uninlined_format_args
```

* address feedback
2023-08-13 14:14:31 -05:00
Deadbeef
a9ae746267 misc code cleanup 2023-07-19 22:26:43 -05:00
Caleb Cartwright
78331eefaf Merge commit 'dca1cf90ad6b8e45afbed2061803befbb2d159e9' into sync-rustfmt 2023-07-01 02:49:12 -05:00
Yacin Tmimi
1de65a2711 wrap else to next line if let-else pattern is multi-lined
This rule wasn't explicity stated in the style guide so it was missed,
but luckily we caught it during testing.
2023-07-01 01:06:35 -05:00
Yacin Tmimi
7b4e8a6d31 update else_block_exceeds_width calculation in let-else rewrite
By reversing the logic I felt that the code became a clearer. Also,
added a comment to make it clear that we need to take the trailing
semicolon for the `let-else` statement into account.
2023-07-01 01:06:35 -05:00
Yacin Tmimi
fe8b72d98e implement single_line_let_else_max_width
This allows users to configure the maximum length of a single line
`let-else` statements. `let-else` statements that otherwise meet the
requirements to be formatted on a single line will have their divergent
`else` block formatted over multiple lines if they exceed this length.

**Note**: `single_line_let_else_max_widt` will be introduced as a stable
configuration option.
2023-07-01 01:06:35 -05:00