@@ -359,9 +359,10 @@ fn get_updates(ws: &Workspace<'_>, package_ids: &BTreeSet<PackageId>) -> Option<
359
359
360
360
if !updated_versions. is_empty ( ) {
361
361
let updated_versions = itertools:: join ( updated_versions, ", " ) ;
362
- writeln ! (
362
+ write ! (
363
363
updates,
364
- "{} has the following newer versions available: {}" ,
364
+ "
365
+ {} has the following newer versions available: {}" ,
365
366
pkg_id, updated_versions
366
367
)
367
368
. unwrap ( ) ;
@@ -432,11 +433,10 @@ pub fn save_and_display_report(
432
433
433
434
let update_message = if !updated_versions. is_empty ( ) {
434
435
format ! (
435
- "
436
- - Some affected dependencies have newer versions available.
436
+ "\
437
+ Some affected dependencies have newer versions available.
437
438
You may want to consider updating them to a newer version to see if the issue has been fixed.
438
-
439
- {updated_versions}\n " ,
439
+ {updated_versions}" ,
440
440
updated_versions = updated_versions
441
441
)
442
442
} else {
@@ -448,8 +448,7 @@ You may want to consider updating them to a newer version to see if the issue ha
448
448
. map ( |package_id| {
449
449
let manifest = bcx. packages . get_one ( * package_id) . unwrap ( ) . manifest ( ) ;
450
450
format ! (
451
- "
452
- - {package_spec}
451
+ " - {package_spec}
453
452
- Repository: {url}
454
453
- Detailed warning command: `cargo report future-incompatibilities --id {id} --package {package_spec}`" ,
455
454
package_spec = format!( "{}@{}" , package_id. name( ) , package_id. version( ) ) ,
@@ -462,36 +461,61 @@ You may want to consider updating them to a newer version to see if the issue ha
462
461
)
463
462
} )
464
463
. collect :: < Vec < _ > > ( )
465
- . join ( "\n " ) ;
464
+ . join ( "\n \n " ) ;
466
465
467
466
let all_is_local = per_package_future_incompat_reports
468
467
. iter ( )
469
468
. all ( |report| report. is_local ) ;
470
469
471
- let suggestion_message = if all_is_local {
472
- String :: new ( )
473
- } else {
474
- format ! (
475
- "
476
- To solve this problem, you can try the following approaches:
477
-
478
- {update_message} \
479
- - If the issue is not solved by updating the dependencies, a fix has to be
470
+ let suggestion_header = "To solve this problem, you can try the following approaches:" ;
471
+ let mut suggestions = Vec :: new ( ) ;
472
+ if !all_is_local {
473
+ if !update_message . is_empty ( ) {
474
+ suggestions . push ( update_message ) ;
475
+ }
476
+ suggestions . push ( format ! (
477
+ " \
478
+ If the issue is not solved by updating the dependencies, a fix has to be
480
479
implemented by those dependencies. You can help with that by notifying the
481
480
maintainers of this problem (e.g. by creating a bug report) or by proposing a
482
481
fix to the maintainers (e.g. by creating a pull request):
483
- {upstream_info}
484
482
485
- - If waiting for an upstream fix is not an option, you can use the `[patch]`
483
+ {upstream_info}"
484
+ ) ) ;
485
+ suggestions. push (
486
+ "\
487
+ If waiting for an upstream fix is not an option, you can use the `[patch]`
486
488
section in `Cargo.toml` to use your own version of the dependency. For more
487
489
information, see:
488
- https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section
489
- " ,
490
- upstream_info = upstream_info,
491
- update_message = update_message,
490
+ https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section"
491
+ . to_owned ( ) ,
492
+ ) ;
493
+ }
494
+
495
+ let suggestion_message = if suggestions. is_empty ( ) {
496
+ String :: new ( )
497
+ } else {
498
+ let mut suggestion_message = String :: new ( ) ;
499
+ writeln ! (
500
+ & mut suggestion_message,
501
+ "
502
+ {suggestion_header}"
492
503
)
504
+ . unwrap ( ) ;
505
+ if suggestions. len ( ) == 3 {
506
+ // HACK: there is an inconsistent leading line in this case
507
+ writeln ! ( & mut suggestion_message) . unwrap ( ) ;
508
+ }
509
+ for suggestion in & suggestions {
510
+ writeln ! (
511
+ & mut suggestion_message,
512
+ "
513
+ - {suggestion}"
514
+ )
515
+ . unwrap ( ) ;
516
+ }
517
+ suggestion_message
493
518
} ;
494
-
495
519
let saved_report_id =
496
520
current_reports. save_report ( bcx. ws , suggestion_message. clone ( ) , rendered_report) ;
497
521
0 commit comments