Skip to content

Commit d65daa9

Browse files
refactor: rebase with set_cli() behavior
1 parent 7a5a936 commit d65daa9

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

Diff for: src/bin/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ impl CliOptions for GetOptsOptions {
708708
config.set_cli().edition(edition);
709709
}
710710
if let Some(edition) = self.style_edition {
711-
config.set().style_edition(edition);
711+
config.set_cli().style_edition(edition);
712712
}
713713
if self.check {
714714
config.set_cli().emit_mode(EmitMode::Diff);

Diff for: src/config/config_type.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ macro_rules! create_config {
164164
"merge_imports" => self.0.set_merge_imports(),
165165
"fn_args_layout" => self.0.set_fn_args_layout(),
166166
"hide_parse_errors" => self.0.set_hide_parse_errors(),
167+
"version" => self.0.set_version(),
168+
"edition" => self.0.set_edition(),
167169
&_ => (),
168170
}
169171
}
@@ -576,7 +578,7 @@ macro_rules! create_config {
576578
Use `style_edition` instead."
577579
);
578580

579-
if self.was_set().style_edition() {
581+
if self.was_set().style_edition() || self.was_set_cli().style_edition() {
580582
eprintln!(
581583
"Warning: the deprecated `version` option was \
582584
used in conjunction with the `edition` or \
@@ -591,7 +593,10 @@ macro_rules! create_config {
591593
}
592594

593595
fn set_edition(&mut self) {
594-
if self.was_set().style_edition() || self.was_set().version() {
596+
let style_edition_set = self.was_set().style_edition()
597+
|| self.was_set_cli().style_edition();
598+
599+
if style_edition_set || self.was_set().version() {
595600
return;
596601
}
597602

Diff for: src/config/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,7 @@ match_block_trailing_comma = false
779779
blank_lines_upper_bound = 1
780780
blank_lines_lower_bound = 0
781781
edition = "2015"
782+
style_edition = "2024"
782783
version = "Two"
783784
inline_attribute_width = 0
784785
format_generated_files = true

Diff for: src/config/options.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,8 @@ config_option_with_style_edition_default!(
638638
BlankLinesUpperBound, usize, _ => 1;
639639
BlankLinesLowerBound, usize, _ => 0;
640640
EditionConfig, Edition, _ => Edition::Edition2015;
641-
StyleEditionConfig, StyleEdition, _ => StyleEdition::Edition2015;
641+
StyleEditionConfig, StyleEdition,
642+
Edition2024 => StyleEdition::Edition2024, _ => StyleEdition::Edition2015;
642643
VersionConfig, Version, Edition2024 => Version::Two, _ => Version::One;
643644
InlineAttributeWidth, usize, _ => 0;
644645
FormatGeneratedFiles, bool, _ => true;

0 commit comments

Comments
 (0)