diff options
| author | Caleb Cartwright <caleb.cartwright@outlook.com> | 2024-07-27 17:56:03 -0500 |
|---|---|---|
| committer | Caleb Cartwright <calebcartwright@users.noreply.github.com> | 2024-07-28 19:37:36 -0500 |
| commit | d65daa9c4fb9be42a21a26a91451606a87f80702 (patch) | |
| tree | ee375befdb33512dc5f5bee4da637a1232c89aed | |
| parent | 7a5a936e79a479592561db63a9de9fa30aed47d5 (diff) | |
| download | rust-d65daa9c4fb9be42a21a26a91451606a87f80702.tar.gz rust-d65daa9c4fb9be42a21a26a91451606a87f80702.zip | |
refactor: rebase with set_cli() behavior
| -rw-r--r-- | src/bin/main.rs | 2 | ||||
| -rw-r--r-- | src/config/config_type.rs | 9 | ||||
| -rw-r--r-- | src/config/mod.rs | 1 | ||||
| -rw-r--r-- | src/config/options.rs | 3 |
4 files changed, 11 insertions, 4 deletions
diff --git a/src/bin/main.rs b/src/bin/main.rs index 2b5d5209b4f..0876c515dde 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -708,7 +708,7 @@ impl CliOptions for GetOptsOptions { config.set_cli().edition(edition); } if let Some(edition) = self.style_edition { - config.set().style_edition(edition); + config.set_cli().style_edition(edition); } if self.check { config.set_cli().emit_mode(EmitMode::Diff); diff --git a/src/config/config_type.rs b/src/config/config_type.rs index 3a3500e4ef8..43f014764c9 100644 --- a/src/config/config_type.rs +++ b/src/config/config_type.rs @@ -164,6 +164,8 @@ macro_rules! create_config { "merge_imports" => self.0.set_merge_imports(), "fn_args_layout" => self.0.set_fn_args_layout(), "hide_parse_errors" => self.0.set_hide_parse_errors(), + "version" => self.0.set_version(), + "edition" => self.0.set_edition(), &_ => (), } } @@ -576,7 +578,7 @@ macro_rules! create_config { Use `style_edition` instead." ); - if self.was_set().style_edition() { + if self.was_set().style_edition() || self.was_set_cli().style_edition() { eprintln!( "Warning: the deprecated `version` option was \ used in conjunction with the `edition` or \ @@ -591,7 +593,10 @@ macro_rules! create_config { } fn set_edition(&mut self) { - if self.was_set().style_edition() || self.was_set().version() { + let style_edition_set = self.was_set().style_edition() + || self.was_set_cli().style_edition(); + + if style_edition_set || self.was_set().version() { return; } diff --git a/src/config/mod.rs b/src/config/mod.rs index 9103a4859ab..e4690e5beca 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -779,6 +779,7 @@ match_block_trailing_comma = false blank_lines_upper_bound = 1 blank_lines_lower_bound = 0 edition = "2015" +style_edition = "2024" version = "Two" inline_attribute_width = 0 format_generated_files = true diff --git a/src/config/options.rs b/src/config/options.rs index 7c0a3609775..65fc702c4bc 100644 --- a/src/config/options.rs +++ b/src/config/options.rs @@ -638,7 +638,8 @@ config_option_with_style_edition_default!( BlankLinesUpperBound, usize, _ => 1; BlankLinesLowerBound, usize, _ => 0; EditionConfig, Edition, _ => Edition::Edition2015; - StyleEditionConfig, StyleEdition, _ => StyleEdition::Edition2015; + StyleEditionConfig, StyleEdition, + Edition2024 => StyleEdition::Edition2024, _ => StyleEdition::Edition2015; VersionConfig, Version, Edition2024 => Version::Two, _ => Version::One; InlineAttributeWidth, usize, _ => 0; FormatGeneratedFiles, bool, _ => true; |
