@@ -954,28 +954,15 @@ impl<'cfg> DrainState<'cfg> {
954
954
. collect :: < Vec < _ > > ( )
955
955
. join ( "\n " ) ;
956
956
957
- let ( compat , incompat ) =
958
- get_updates ( bcx. ws , & package_ids) . unwrap_or ( ( String :: new ( ) , String :: new ( ) ) ) ;
957
+ let updated_versions =
958
+ get_updates ( bcx. ws , & package_ids) . unwrap_or ( String :: new ( ) ) ;
959
959
960
- let compat_message = if !compat . is_empty ( ) {
960
+ let update_message = if !updated_versions . is_empty ( ) {
961
961
format ! (
962
962
"
963
- - Some affected dependencies have minor or patch version updates available:
964
- {compat}" ,
965
- compat = compat
966
- )
967
- } else {
968
- String :: new ( )
969
- } ;
970
-
971
- let incompat_message = if !incompat. is_empty ( ) {
972
- format ! (
973
- "
974
- - If a minor dependency update does not help, you can try updating to a new
975
- major version of those dependencies. You have to do this manually:
976
- {incompat}
977
- " ,
978
- incompat = incompat
963
+ - Some affected dependencies have updates available:
964
+ {updated_versions}" ,
965
+ updated_versions = updated_versions
979
966
)
980
967
} else {
981
968
String :: new ( )
@@ -985,8 +972,7 @@ impl<'cfg> DrainState<'cfg> {
985
972
"
986
973
To solve this problem, you can try the following approaches:
987
974
988
- {compat_message}
989
- {incompat_message}
975
+ {update_message}
990
976
- If the issue is not solved by updating the dependencies, a fix has to be
991
977
implemented by those dependencies. You can help with that by notifying the
992
978
maintainers of this problem (e.g. by creating a bug report) or by proposing a
@@ -999,8 +985,7 @@ To solve this problem, you can try the following approaches:
999
985
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section
1000
986
" ,
1001
987
upstream_info = upstream_info,
1002
- compat_message = compat_message,
1003
- incompat_message = incompat_message
988
+ update_message = update_message,
1004
989
) ) ) ;
1005
990
1006
991
drop ( bcx. config . shell ( ) . note ( & format ! (
@@ -1354,7 +1339,7 @@ feature resolver. Try updating to diesel 1.4.8 to fix this error.
1354
1339
// Returns a pair (compatible_updates, incompatible_updates),
1355
1340
// of semver-compatible and semver-incompatible update versions,
1356
1341
// respectively.
1357
- fn get_updates ( ws : & Workspace < ' _ > , package_ids : & BTreeSet < PackageId > ) -> Option < ( String , String ) > {
1342
+ fn get_updates ( ws : & Workspace < ' _ > , package_ids : & BTreeSet < PackageId > ) -> Option < String > {
1358
1343
// This in general ignores all errors since this is opportunistic.
1359
1344
let _lock = ws. config ( ) . acquire_package_cache_lock ( ) . ok ( ) ?;
1360
1345
// Create a set of updated registry sources.
@@ -1375,50 +1360,32 @@ fn get_updates(ws: &Workspace<'_>, package_ids: &BTreeSet<PackageId>) -> Option<
1375
1360
} )
1376
1361
. collect ( ) ;
1377
1362
// Query the sources for new versions.
1378
- let mut compatible = String :: new ( ) ;
1379
- let mut incompatible = String :: new ( ) ;
1363
+ let mut updates = String :: new ( ) ;
1380
1364
for pkg_id in package_ids {
1381
1365
let source = match sources. get_mut ( & pkg_id. source_id ( ) ) {
1382
1366
Some ( s) => s,
1383
1367
None => continue ,
1384
1368
} ;
1385
1369
let dep = Dependency :: parse ( pkg_id. name ( ) , None , pkg_id. source_id ( ) ) . ok ( ) ?;
1386
1370
let summaries = source. query_vec ( & dep) . ok ( ) ?;
1387
- let ( mut compatible_versions, mut incompatible_versions) : ( Vec < _ > , Vec < _ > ) = summaries
1388
- . iter ( )
1389
- . map ( |summary| summary. version ( ) )
1371
+ let mut updated_versions: Vec < _ > = summaries. iter ( ) . map ( |summary| summary. version ( ) )
1390
1372
. filter ( |version| * version > pkg_id. version ( ) )
1391
- . partition ( |version| version. major == pkg_id. version ( ) . major ) ;
1392
- compatible_versions. sort ( ) ;
1393
- incompatible_versions. sort ( ) ;
1394
-
1395
- let compatible_versions = compatible_versions
1396
- . into_iter ( )
1397
- . map ( |version| version. to_string ( ) ) ;
1398
- let compatible_versions = iter_join ( compatible_versions, ", " ) ;
1373
+ . collect ( ) ;
1374
+ updated_versions. sort ( ) ;
1399
1375
1400
- let incompatible_versions = incompatible_versions
1376
+ let updated_versions = iter_join ( updated_versions
1401
1377
. into_iter ( )
1402
- . map ( |version| version. to_string ( ) ) ;
1403
- let incompatible_versions = iter_join ( incompatible_versions, ", " ) ;
1404
-
1405
- if !compatible_versions. is_empty ( ) {
1406
- writeln ! (
1407
- compatible,
1408
- "{} has the following newer versions available: {}" ,
1409
- pkg_id, compatible_versions
1410
- )
1411
- . unwrap ( ) ;
1412
- }
1378
+ . map ( |version| version. to_string ( ) ) ,
1379
+ ", " ) ;
1413
1380
1414
- if !incompatible_versions . is_empty ( ) {
1381
+ if !updated_versions . is_empty ( ) {
1415
1382
writeln ! (
1416
- incompatible ,
1383
+ updates ,
1417
1384
"{} has the following newer versions available: {}" ,
1418
- pkg_id, incompatible_versions
1385
+ pkg_id, updated_versions
1419
1386
)
1420
1387
. unwrap ( ) ;
1421
1388
}
1422
1389
}
1423
- Some ( ( compatible , incompatible ) )
1390
+ Some ( updates )
1424
1391
}
0 commit comments