@@ -1071,7 +1071,7 @@ impl<'cfg> Workspace<'cfg> {
1071
1071
if self . allows_new_cli_feature_behavior ( ) {
1072
1072
self . members_with_features_new ( specs, cli_features)
1073
1073
} else {
1074
- self . members_with_features_old ( specs, cli_features)
1074
+ Ok ( self . members_with_features_old ( specs, cli_features) )
1075
1075
}
1076
1076
}
1077
1077
@@ -1196,7 +1196,7 @@ impl<'cfg> Workspace<'cfg> {
1196
1196
& self ,
1197
1197
specs : & [ PackageIdSpec ] ,
1198
1198
cli_features : & CliFeatures ,
1199
- ) -> CargoResult < Vec < ( & Package , CliFeatures ) > > {
1199
+ ) -> Vec < ( & Package , CliFeatures ) > {
1200
1200
// Split off any features with the syntax `member-name/feature-name` into a map
1201
1201
// so that those features can be applied directly to those workspace-members.
1202
1202
let mut member_specific_features: HashMap < InternedString , BTreeSet < FeatureValue > > =
@@ -1215,30 +1215,32 @@ impl<'cfg> Workspace<'cfg> {
1215
1215
} => panic ! ( "unexpected dep: syntax {}" , feature) ,
1216
1216
FeatureValue :: DepFeature {
1217
1217
dep_name,
1218
- dep_feature : _ ,
1218
+ dep_feature,
1219
1219
dep_prefix : _,
1220
1220
weak : _,
1221
1221
} => {
1222
- // Check if `dep_name` is member of the workspace, but isn't associated with current package.
1223
- // Weak can be ignored for this moment.
1222
+ // I think weak can be ignored here.
1223
+ // * With `--features member?/feat -p member`, the ? doesn't
1224
+ // really mean anything (either the member is built or it isn't).
1225
+ // * With `--features nonmember?/feat`, cwd_features will
1226
+ // handle processing it correctly.
1224
1227
let is_member = self . members ( ) . any ( |member| {
1228
+ // Check if `dep_name` is member of the workspace, but isn't associated with current package.
1225
1229
self . current_opt ( ) != Some ( member) && member. name ( ) == * dep_name
1226
1230
} ) ;
1227
1231
if is_member && specs. iter ( ) . any ( |spec| spec. name ( ) == * dep_name) {
1228
1232
member_specific_features
1229
1233
. entry ( * dep_name)
1230
1234
. or_default ( )
1231
- . insert ( feature . clone ( ) ) ;
1235
+ . insert ( FeatureValue :: Feature ( * dep_feature ) ) ;
1232
1236
} else {
1233
- // With `--features nonmember?/feat`, cwd_features will
1234
- // handle processing it correctly.
1235
1237
cwd_features. insert ( feature. clone ( ) ) ;
1236
1238
}
1237
1239
}
1238
1240
}
1239
1241
}
1240
1242
1241
- let result : Vec < _ > = self
1243
+ let ms : Vec < _ > = self
1242
1244
. members ( )
1243
1245
. filter_map ( |member| {
1244
1246
let member_id = member. package_id ( ) ;
@@ -1251,13 +1253,13 @@ impl<'cfg> Workspace<'cfg> {
1251
1253
all_features : cli_features. all_features ,
1252
1254
uses_default_features : cli_features. uses_default_features ,
1253
1255
} ;
1254
-
1255
1256
Some ( ( member, feats) )
1256
1257
}
1257
1258
_ => {
1258
1259
// Ignore members that are not enabled on the command-line.
1259
1260
if specs. iter ( ) . any ( |spec| spec. matches ( member_id) ) {
1260
- // -p for a workspace member that is not the "current" one.
1261
+ // -p for a workspace member that is not the "current"
1262
+ // one.
1261
1263
//
1262
1264
// The odd behavior here is due to backwards
1263
1265
// compatibility. `--features` and
@@ -1269,27 +1271,11 @@ impl<'cfg> Workspace<'cfg> {
1269
1271
features : Rc :: new (
1270
1272
member_specific_features
1271
1273
. remove ( member. name ( ) . as_str ( ) )
1272
- . unwrap_or_default ( )
1273
- . into_iter ( )
1274
- . map ( |feature| match feature {
1275
- // I think weak can be ignored here.
1276
- // With `--features member?/feat -p member`, the ? doesn't
1277
- // really mean anything (either the member is built or it isn't).
1278
- FeatureValue :: DepFeature {
1279
- dep_name : _,
1280
- dep_feature,
1281
- dep_prefix : false ,
1282
- weak : _,
1283
- } => FeatureValue :: new ( dep_feature) ,
1284
- // Member specific features by definition contain only `FeatureValue::DepFeature`
1285
- _ => unreachable ! ( ) ,
1286
- } )
1287
- . collect ( ) ,
1274
+ . unwrap_or_default ( ) ,
1288
1275
) ,
1289
1276
uses_default_features : true ,
1290
1277
all_features : cli_features. all_features ,
1291
1278
} ;
1292
-
1293
1279
Some ( ( member, feats) )
1294
1280
} else {
1295
1281
// This member was not requested on the command-line, skip.
@@ -1304,7 +1290,7 @@ impl<'cfg> Workspace<'cfg> {
1304
1290
// some features will be ignored.
1305
1291
assert ! ( member_specific_features. is_empty( ) ) ;
1306
1292
1307
- Ok ( result )
1293
+ ms
1308
1294
}
1309
1295
}
1310
1296
0 commit comments