@@ -1058,7 +1058,7 @@ impl TomlManifest {
1058
1058
Edition :: Edition2015
1059
1059
} ;
1060
1060
1061
- if let Some ( rust_version) = & project. rust_version {
1061
+ let rust_version = if let Some ( rust_version) = & project. rust_version {
1062
1062
if features. require ( Feature :: rust_version ( ) ) . is_err ( ) {
1063
1063
let mut msg =
1064
1064
"`rust-version` is not supported on this version of Cargo and will be ignored"
@@ -1077,28 +1077,31 @@ impl TomlManifest {
1077
1077
) ;
1078
1078
}
1079
1079
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
+ }
1099
1099
}
1100
+ Some ( rust_version. clone ( ) )
1100
1101
}
1101
- }
1102
+ } else {
1103
+ None
1104
+ } ;
1102
1105
1103
1106
if project. metabuild . is_some ( ) {
1104
1107
features. require ( Feature :: metabuild ( ) ) ?;
@@ -1339,7 +1342,7 @@ impl TomlManifest {
1339
1342
workspace_config,
1340
1343
features,
1341
1344
edition,
1342
- project . rust_version . clone ( ) ,
1345
+ rust_version,
1343
1346
project. im_a_teapot ,
1344
1347
project. default_run . clone ( ) ,
1345
1348
Rc :: clone ( me) ,
0 commit comments