@@ -59,13 +59,11 @@ use crate::util::{existing_vcs_repo, LockServer, LockServerClient};
5959
6060const FIX_ENV : & str = "__CARGO_FIX_PLZ" ;
6161const BROKEN_CODE_ENV : & str = "__CARGO_FIX_BROKEN_CODE" ;
62- const PREPARE_FOR_ENV : & str = "__CARGO_FIX_PREPARE_FOR" ;
6362const EDITION_ENV : & str = "__CARGO_FIX_EDITION" ;
6463const IDIOMS_ENV : & str = "__CARGO_FIX_IDIOMS" ;
6564
66- pub struct FixOptions < ' a > {
65+ pub struct FixOptions {
6766 pub edition : bool ,
68- pub prepare_for : Option < & ' a str > ,
6967 pub idioms : bool ,
7068 pub compile_opts : CompileOptions ,
7169 pub allow_dirty : bool ,
@@ -74,7 +72,7 @@ pub struct FixOptions<'a> {
7472 pub broken_code : bool ,
7573}
7674
77- pub fn fix ( ws : & Workspace < ' _ > , opts : & mut FixOptions < ' _ > ) -> CargoResult < ( ) > {
75+ pub fn fix ( ws : & Workspace < ' _ > , opts : & mut FixOptions ) -> CargoResult < ( ) > {
7876 check_version_control ( ws. config ( ) , opts) ?;
7977
8078 // Spin up our lock server, which our subprocesses will use to synchronize fixes.
@@ -91,8 +89,6 @@ pub fn fix(ws: &Workspace<'_>, opts: &mut FixOptions<'_>) -> CargoResult<()> {
9189
9290 if opts. edition {
9391 wrapper. env ( EDITION_ENV , "1" ) ;
94- } else if let Some ( edition) = opts. prepare_for {
95- wrapper. env ( PREPARE_FOR_ENV , edition) ;
9692 }
9793 if opts. idioms {
9894 wrapper. env ( IDIOMS_ENV , "1" ) ;
@@ -125,7 +121,7 @@ pub fn fix(ws: &Workspace<'_>, opts: &mut FixOptions<'_>) -> CargoResult<()> {
125121 Ok ( ( ) )
126122}
127123
128- fn check_version_control ( config : & Config , opts : & FixOptions < ' _ > ) -> CargoResult < ( ) > {
124+ fn check_version_control ( config : & Config , opts : & FixOptions ) -> CargoResult < ( ) > {
129125 if opts. allow_no_vcs {
130126 return Ok ( ( ) ) ;
131127 }
@@ -647,17 +643,11 @@ impl FixArgs {
647643 let file = file. ok_or_else ( || anyhow:: anyhow!( "could not find .rs file in rustc args" ) ) ?;
648644 let idioms = env:: var ( IDIOMS_ENV ) . is_ok ( ) ;
649645
650- let prepare_for_edition = if let Ok ( s) = env:: var ( PREPARE_FOR_ENV ) {
651- Some ( s. parse ( ) ?)
652- } else if env:: var ( EDITION_ENV ) . is_ok ( ) {
653- match enabled_edition {
654- None | Some ( Edition :: Edition2015 ) => Some ( Edition :: Edition2018 ) ,
655- Some ( Edition :: Edition2018 ) => Some ( Edition :: Edition2021 ) ,
656- Some ( Edition :: Edition2021 ) => Some ( Edition :: Edition2021 ) ,
657- }
658- } else {
659- None
660- } ;
646+ let prepare_for_edition = env:: var ( EDITION_ENV ) . ok ( ) . map ( |_| {
647+ enabled_edition
648+ . unwrap_or ( Edition :: Edition2015 )
649+ . saturating_next ( )
650+ } ) ;
661651
662652 Ok ( FixArgs {
663653 file,
0 commit comments