Skip to content

Commit 5f48fe9

Browse files
authored
Add style_edition 2027 (#6324)
1 parent 6157568 commit 5f48fe9

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/bin/main.rs

+1
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,7 @@ fn style_edition_from_style_edition_str(edition_str: &str) -> Result<StyleEditio
770770
"2018" => Ok(StyleEdition::Edition2018),
771771
"2021" => Ok(StyleEdition::Edition2021),
772772
"2024" => Ok(StyleEdition::Edition2024),
773+
"2027" => Ok(StyleEdition::Edition2027),
773774
_ => Err(format_err!("Invalid value for `--style-edition`")),
774775
}
775776
}

src/config/options.rs

+7
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,11 @@ pub enum StyleEdition {
514514
#[unstable_variant]
515515
/// [Edition 2024]().
516516
Edition2024,
517+
#[value = "2027"]
518+
#[doc_hint = "2027"]
519+
#[unstable_variant]
520+
/// [Edition 2027]().
521+
Edition2027,
517522
}
518523

519524
impl From<StyleEdition> for rustc_span::edition::Edition {
@@ -523,6 +528,8 @@ impl From<StyleEdition> for rustc_span::edition::Edition {
523528
StyleEdition::Edition2018 => Self::Edition2018,
524529
StyleEdition::Edition2021 => Self::Edition2021,
525530
StyleEdition::Edition2024 => Self::Edition2024,
531+
// TODO: should update to Edition2027 when it becomes available
532+
StyleEdition::Edition2027 => Self::Edition2024,
526533
}
527534
}
528535
}

src/config/style_edition.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ macro_rules! style_edition_default {
3030
$crate::config::StyleEdition::Edition2015
3131
| $crate::config::StyleEdition::Edition2018
3232
| $crate::config::StyleEdition::Edition2021 => $default_2015,
33-
$crate::config::StyleEdition::Edition2024 => $default_2024,
33+
// TODO: should update macro when default_2027 becomes available
34+
$crate::config::StyleEdition::Edition2024
35+
| $crate::config::StyleEdition::Edition2027 => $default_2024,
3436
}
3537
}
3638
}
@@ -52,6 +54,7 @@ mod test {
5254
assert_eq!(Unit::style_edition_default(StyleEdition::Edition2018), 100);
5355
assert_eq!(Unit::style_edition_default(StyleEdition::Edition2021), 100);
5456
assert_eq!(Unit::style_edition_default(StyleEdition::Edition2024), 100);
57+
assert_eq!(Unit::style_edition_default(StyleEdition::Edition2027), 100);
5558
}
5659

5760
#[test]
@@ -66,5 +69,6 @@ mod test {
6669

6770
// style edition 2024
6871
assert_eq!(Unit::style_edition_default(StyleEdition::Edition2024), 50);
72+
assert_eq!(Unit::style_edition_default(StyleEdition::Edition2027), 50);
6973
}
7074
}

0 commit comments

Comments
 (0)