refactor: rebase with set_cli() behavior
This commit is contained in:
parent
7a5a936e79
commit
d65daa9c4f
@ -708,7 +708,7 @@ fn apply_to(self, config: &mut Config) {
|
||||
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);
|
||||
|
@ -164,6 +164,8 @@ pub fn $i(&mut self, value: <$ty as StyleEditionDefault>::ConfigType) {
|
||||
"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 @@ fn set_version(&mut self) {
|
||||
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 @@ fn set_version(&mut self) {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -779,6 +779,7 @@ fn test_dump_style_edition_2024_config() {
|
||||
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
|
||||
|
@ -638,7 +638,8 @@ macro_rules! 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;
|
||||
|
Loading…
Reference in New Issue
Block a user