Commit Graph

3686 Commits

Author SHA1 Message Date
Yacin Tmimi
d66e974c70 remove stray comments 2024-09-11 23:21:24 -04:00
Yacin Tmimi
348a499e8b Merge remote-tracking branch 'upstream/master' into subtree-push-nightly-2024-09-10 2024-09-10 01:15:02 -04:00
cui fliter
91b2c17ffb
Add missing backtick in comment (#6317)
Signed-off-by: cuishuang <imcusg@gmail.com>
2024-09-09 11:23:15 -04:00
Michael Goulet
e1712ea92f Fix tools 2024-09-06 10:32:48 -04:00
ding-young
d720a7ef77 impl rewrite_result for ast::Expr 2024-09-05 02:25:45 -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
Mattias Wallin
1a70f40d7f Avoid allocation in ChainItemKind::is_tup_field_access 2024-09-03 18:48:41 -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
Yacin Tmimi
296417260c use version-sort when reordering imports using style_edition=2024 2024-09-03 15:21:36 -04:00
Yacin Tmimi
1681c91a35 implement version-sorting algorithm for rust identifiers
The algorithm is described in the [style guide] and was introduced in
`r-l/rust 115046`.

[style guide]: https://doc.rust-lang.org/nightly/style-guide/#sorting
2024-09-03 15:21:36 -04:00
Mattias Wallin
5d30ce6844 Avoid allocating intermediate strings in determine_operation 2024-09-02 22:42:53 -04:00
Mattias Wallin
9d407bfd1b Avoid allocating intermediate strings in ItemizedBlock::trimmed_block_as_string 2024-09-02 22:42:53 -04:00
Mattias Wallin
40909b4331 Fix test_editions_2015_2018_2021_identical
Was comparing unit type.
2024-09-01 11:00:56 -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
Nicholas Nethercote
1fcfd57e2f Remove #[macro_use] extern crate tracing from rustfmt helpers. 2024-08-30 13:31:05 +10:00
Caleb Cartwright
46cb7d3220 refactor: improve mapping of legacy 'version' to 'style_edition' 2024-08-27 20:49:15 -05:00
Caleb Cartwright
065258659d feat: implement 2024 Style Edition for expr overflows 2024-08-27 20:49:15 -05:00
Caleb Cartwright
0c6515cacc feat: support style edition differing defaults in config loading 2024-08-27 20:49:15 -05:00
Caleb Cartwright
c0c3dc7a25 refactor: include edition & style edition in CliOptions 2024-08-27 20:49:15 -05:00
Caleb Cartwright
53d5ccd5e9 refactor: use style edition when loading from partial config 2024-08-27 20:49:15 -05:00
ding-young
6f5e99b7b5 update macro rewrite functions to return RewriteResult 2024-08-25 09:23:04 -04:00
Yacin Tmimi
6bcadd6aa4 Merge remote-tracking branch 'upstream/master' into subtree-push-nightly-2024-08-17 2024-08-17 14:36:42 -04:00
ding-young
fbe04244f8 update rewrite_chain to return RewriteResult 2024-08-15 12:32:26 -04:00
Lukasz Anforowicz
caaa612a0b Ensure that fn config_path returns canonicalized paths.
This commit ensures that `fn config_path` in `rustfmt/src/config/mod.rs`
always returns canonicalized paths.  This is achieved by canonicalizing
both: 1) paths received via `CliOptions` (after checking if the path
exists) as well as 2) paths returned via `get_toml_path` (canonicalizing
within `fn get_toml_path`).

Fixes https://github.com/rust-lang/rustfmt/issues/6178
2024-08-14 15:02:38 -04:00
ding-young
68dc912b99 update rewrite functions in imports.rs 2024-08-14 12:36:26 -04:00
Nicholas Nethercote
7b2299a2d2 Use impl PartialEq<TokenKind> for Token more.
This lets us compare a `Token` with a `TokenKind`. It's used a lot, but
can be used even more, avoiding the need for some `.kind` uses.
2024-08-14 16:37:09 +10:00
John Kåre Alsaker
57af02c9c4 Link std statically in rustc_driver 2024-08-11 04:16:53 +02:00
ding-young
40f5075269 impl rewrite_result for Pat, TuplePatField
- also update rewrite_unary_*** to return RewriteResult
2024-08-05 07:53:46 -06:00
David Tolnay
88944668fe Print empty commit info without trailing hyphen 2024-08-04 12:44:32 -06:00
ding-young
b8a5b211ef impl rewrite_result for ChainItem 2024-08-03 04:43:03 -06:00
ding-young
3d468e2d92 update combine_strs_with_missing_comments 2024-08-03 04:43:03 -06:00
ding-young
5325b9e98c modify rewrite_literal 2024-08-03 04:43:03 -06:00
Michael Goulet
90a86a78d2 Suppress must_use on eat calls in rustfmt 2024-07-30 10:10:36 -04:00
Caleb Cartwright
cf352a766f chore: apply review suggestions 2024-07-28 19:37:36 -05:00
Caleb Cartwright
d66ab31b53 tests: add new load_config tests 2024-07-28 19:37:36 -05:00
Caleb Cartwright
d65daa9c4f refactor: rebase with set_cli() behavior 2024-07-28 19:37:36 -05:00
Caleb Cartwright
b6c89fc657 feat: add --style-edition option to rustfmt binary 2024-07-28 19:37:36 -05: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
Caleb Cartwright
c2c9be5b2d feat: implement Style Edition support
Adds the 'style_edition' configuration option along with
documentation, 'version' option deprecation, and mapping
of 'edition' and 'version' values for backwards compatibility
and adherence to the style evolution RFC
2024-07-28 19:37:36 -05:00
Caleb Cartwright
d8ae6a99e6 tests: add a few for style edition config defaults 2024-07-27 17:35:10 -05:00
Caleb Cartwright
a23d3ccb84 refactor: track configs set from cli flags 2024-07-27 17:01:11 -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
ea02de27ff refactor rewrite_match and impl rewrite_result for ArmWrapper 2024-07-17 20:51:42 -06:00
ding-young
babc2f9b8a modify rewrite_struct_lit, rewrite_struct_pat
- refactor rewrite_*** functions that call rewrite_path to return RewriteResult
- modify rewrite_aligned_item method of AlignedItem
2024-07-17 18:40:45 -06:00
ding-young
3cbc91e9d6 modify rewrite_path and impl rewrite_result for related AST nodes 2024-07-17 18:40:45 -06:00