@@ -1058,7 +1058,7 @@ impl TomlManifest {
10581058 Edition :: Edition2015
10591059 } ;
10601060
1061- if let Some ( rust_version) = & project. rust_version {
1061+ let rust_version = if let Some ( rust_version) = & project. rust_version {
10621062 if features. require ( Feature :: rust_version ( ) ) . is_err ( ) {
10631063 let mut msg =
10641064 "`rust-version` is not supported on this version of Cargo and will be ignored"
@@ -1077,28 +1077,31 @@ impl TomlManifest {
10771077 ) ;
10781078 }
10791079 warnings. push ( msg) ;
1080- }
1081-
1082- let req = match semver:: VersionReq :: parse ( rust_version) {
1083- // Exclude semver operators like `^` and pre-release identifiers
1084- Ok ( req) if rust_version. chars ( ) . all ( |c| c. is_ascii_digit ( ) || c == '.' ) => req,
1085- _ => bail ! ( "`rust-version` must be a value like \" 1.32\" " ) ,
1086- } ;
1087-
1088- if let Some ( first_version ) = edition . first_version ( ) {
1089- let unsupported =
1090- semver :: Version :: new ( first_version . major , first_version . minor - 1 , 9999 ) ;
1091- if req . matches ( & unsupported ) {
1092- bail ! (
1093- "rust-version {} is older than first version ({}) required by \
1094- the specified edition ({})" ,
1095- rust_version ,
1096- first_version ,
1097- edition ,
1098- )
1080+ None
1081+ } else {
1082+ let req = match semver:: VersionReq :: parse ( rust_version) {
1083+ // Exclude semver operators like `^` and pre-release identifiers
1084+ Ok ( req) if rust_version. chars ( ) . all ( |c| c. is_ascii_digit ( ) || c == '.' ) => req,
1085+ _ => bail ! ( "`rust-version` must be a value like \" 1.32\" " ) ,
1086+ } ;
1087+ if let Some ( first_version ) = edition . first_version ( ) {
1088+ let unsupported =
1089+ semver :: Version :: new ( first_version . major , first_version . minor - 1 , 9999 ) ;
1090+ if req . matches ( & unsupported ) {
1091+ bail ! (
1092+ "rust-version {} is older than first version ({}) required by \
1093+ the specified edition ({})" ,
1094+ rust_version ,
1095+ first_version ,
1096+ edition ,
1097+ )
1098+ }
10991099 }
1100+ Some ( rust_version. clone ( ) )
11001101 }
1101- }
1102+ } else {
1103+ None
1104+ } ;
11021105
11031106 if project. metabuild . is_some ( ) {
11041107 features. require ( Feature :: metabuild ( ) ) ?;
@@ -1339,7 +1342,7 @@ impl TomlManifest {
13391342 workspace_config,
13401343 features,
13411344 edition,
1342- project . rust_version . clone ( ) ,
1345+ rust_version,
13431346 project. im_a_teapot ,
13441347 project. default_run . clone ( ) ,
13451348 Rc :: clone ( me) ,
0 commit comments