Skip to content

Commit 27da845

Browse files
committed
fix(shell): Switch to annotate snippets for notes
1 parent 78d8349 commit 27da845

11 files changed

+142
-139
lines changed

src/cargo/core/shell.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,10 @@ impl Shell {
227227

228228
/// Prints a cyan 'note' message.
229229
pub fn note<T: fmt::Display>(&mut self, message: T) -> CargoResult<()> {
230-
self.print(&"note", Some(&message), &NOTE, false)
230+
let report = &[annotate_snippets::Group::with_title(
231+
annotate_snippets::Level::NOTE.secondary_title(message.to_string()),
232+
)];
233+
self.print_report(report, false)
231234
}
232235

233236
/// Updates the verbosity of the shell.

tests/testsuite/alt_registry.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
363363
[UPLOADING] foo v0.0.1 ([ROOT]/foo)
364364
[UPLOADED] foo v0.0.1 to registry `alternative`
365365
[NOTE] waiting for foo v0.0.1 to be available at registry `alternative`.
366-
You may press ctrl-c to skip waiting; the crate should be available shortly.
366+
You may press ctrl-c to skip waiting; the crate should be available shortly.
367367
[PUBLISHED] foo v0.0.1 at registry `alternative`
368368
369369
"#]])
@@ -526,7 +526,7 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
526526
[UPLOADING] foo v0.0.1 ([ROOT]/foo)
527527
[UPLOADED] foo v0.0.1 to registry `alternative`
528528
[NOTE] waiting for foo v0.0.1 to be available at registry `alternative`.
529-
You may press ctrl-c to skip waiting; the crate should be available shortly.
529+
You may press ctrl-c to skip waiting; the crate should be available shortly.
530530
[PUBLISHED] foo v0.0.1 at registry `alternative`
531531
532532
"#]])
@@ -608,7 +608,7 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
608608
[UPLOADING] foo v0.0.1 ([ROOT]/foo)
609609
[UPLOADED] foo v0.0.1 to registry `alternative`
610610
[NOTE] waiting for foo v0.0.1 to be available at registry `alternative`.
611-
You may press ctrl-c to skip waiting; the crate should be available shortly.
611+
You may press ctrl-c to skip waiting; the crate should be available shortly.
612612
[PUBLISHED] foo v0.0.1 at registry `alternative`
613613
614614
"#]])

tests/testsuite/artifact_dep.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2262,7 +2262,7 @@ fn publish_artifact_dep() {
22622262
[UPLOADING] foo v0.1.0 ([ROOT]/foo)
22632263
[UPLOADED] foo v0.1.0 to registry `crates-io`
22642264
[NOTE] waiting for foo v0.1.0 to be available at registry `crates-io`.
2265-
You may press ctrl-c to skip waiting; the crate should be available shortly.
2265+
You may press ctrl-c to skip waiting; the crate should be available shortly.
22662266
[PUBLISHED] foo v0.1.0 at registry `crates-io`
22672267
22682268
"#]])

tests/testsuite/cargo_features.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
708708
[UPLOADING] a v0.0.1 ([ROOT]/foo)
709709
[UPLOADED] a v0.0.1 to registry `crates-io`
710710
[NOTE] waiting for a v0.0.1 to be available at registry `crates-io`.
711-
You may press ctrl-c to skip waiting; the crate should be available shortly.
711+
You may press ctrl-c to skip waiting; the crate should be available shortly.
712712
[PUBLISHED] a v0.0.1 at registry `crates-io`
713713
714714
"#]])

tests/testsuite/credential_process.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn publish() {
8181
{"v":1,"registry":{"index-url":"[..]","name":"alternative"},"kind":"get","operation":"publish","name":"foo","vers":"0.1.0","cksum":"[..]"}
8282
[UPLOADED] foo v0.1.0 to registry `alternative`
8383
[NOTE] waiting for foo v0.1.0 to be available at registry `alternative`.
84-
You may press ctrl-c [..]
84+
You may press ctrl-c to skip waiting; the crate should be available shortly.
8585
[PUBLISHED] foo v0.1.0 at registry `alternative`
8686
8787
"#]])
@@ -564,7 +564,7 @@ fn token_caching() {
564564
{"v":1,"registry":{"index-url":"[..]","name":"alternative"},"kind":"get","operation":"publish","name":"foo","vers":"0.1.0","cksum":"[..]"}
565565
[UPLOADED] foo v0.1.0 to registry `alternative`
566566
[NOTE] waiting [..]
567-
You may press ctrl-c [..]
567+
You may press ctrl-c to skip waiting; the crate should be available shortly.
568568
[PUBLISHED] foo v0.1.0 at registry `alternative`
569569
570570
"#]];
@@ -585,7 +585,7 @@ You may press ctrl-c [..]
585585
{"v":1,"registry":{"index-url":"[..]","name":"alternative"},"kind":"get","operation":"publish","name":"foo","vers":"0.1.1","cksum":"[..]"}
586586
[UPLOADED] foo v0.1.1 to registry `alternative`
587587
[NOTE] waiting [..]
588-
You may press ctrl-c [..]
588+
You may press ctrl-c to skip waiting; the crate should be available shortly.
589589
[PUBLISHED] foo v0.1.1 at registry `alternative`
590590
591591
"#]];

tests/testsuite/features_namespaced.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ fn publish_no_implicit() {
931931
[UPLOADING] foo v0.1.0 ([ROOT]/foo)
932932
[UPLOADED] foo v0.1.0 to registry `crates-io`
933933
[NOTE] waiting for foo v0.1.0 to be available at registry `crates-io`.
934-
You may press ctrl-c to skip waiting; the crate should be available shortly.
934+
You may press ctrl-c to skip waiting; the crate should be available shortly.
935935
[PUBLISHED] foo v0.1.0 at registry `crates-io`
936936
937937
"#]])
@@ -1075,7 +1075,7 @@ fn publish() {
10751075
[UPLOADING] foo v0.1.0 ([ROOT]/foo)
10761076
[UPLOADED] foo v0.1.0 to registry `crates-io`
10771077
[NOTE] waiting for foo v0.1.0 to be available at registry `crates-io`.
1078-
You may press ctrl-c to skip waiting; the crate should be available shortly.
1078+
You may press ctrl-c to skip waiting; the crate should be available shortly.
10791079
[PUBLISHED] foo v0.1.0 at registry `crates-io`
10801080
10811081
"#]])

tests/testsuite/future_incompat_report.rs

Lines changed: 81 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -147,22 +147,22 @@ fn incompat_in_dependency() {
147147
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
148148
[WARNING] the following packages contain code that will be rejected by a future version of Rust: bar v1.0.0
149149
[NOTE]
150-
To solve this problem, you can try the following approaches:
151-
152-
- If the issue is not solved by updating the dependencies, a fix has to be
153-
implemented by those dependencies. You can help with that by notifying the
154-
maintainers of this problem (e.g. by creating a bug report) or by proposing a
155-
fix to the maintainers (e.g. by creating a pull request):
156-
157-
158-
- Repository: https://example.com/
159-
- Detailed warning command: `cargo report future-incompatibilities --id 1 --package [email protected]`
160-
161-
- If waiting for an upstream fix is not an option, you can use the `[patch]`
162-
section in `Cargo.toml` to use your own version of the dependency. For more
163-
information, see:
164-
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section
165-
150+
To solve this problem, you can try the following approaches:
151+
152+
- If the issue is not solved by updating the dependencies, a fix has to be
153+
implemented by those dependencies. You can help with that by notifying the
154+
maintainers of this problem (e.g. by creating a bug report) or by proposing a
155+
fix to the maintainers (e.g. by creating a pull request):
156+
157+
158+
- Repository: https://example.com/
159+
- Detailed warning command: `cargo report future-incompatibilities --id 1 --package [email protected]`
160+
161+
- If waiting for an upstream fix is not an option, you can use the `[patch]`
162+
section in `Cargo.toml` to use your own version of the dependency. For more
163+
information, see:
164+
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section
165+
166166
[NOTE] this report can be shown with `cargo report future-incompatibilities --id 1`
167167
168168
"#]])
@@ -372,9 +372,9 @@ fn test_multi_crate() {
372372
...
373373
[WARNING] the following packages contain code that will be rejected by a future version of Rust: first-dep v0.0.1, second-dep v0.0.2
374374
...
375-
375+
376376
...
377-
377+
378378
...
379379
")
380380
.run();
@@ -601,38 +601,38 @@ fn suggestions_for_updates() {
601601
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
602602
[WARNING] the following packages contain code that will be rejected by a future version of Rust: big_update v1.0.0, with_updates v1.0.0, without_updates v1.0.0
603603
[NOTE]
604-
To solve this problem, you can try the following approaches:
605-
606-
607-
- Some affected dependencies have newer versions available.
608-
You may want to consider updating them to a newer version to see if the issue has been fixed.
609-
610-
big_update v1.0.0 has the following newer versions available: 2.0.0
611-
with_updates v1.0.0 has the following newer versions available: 1.0.1, 1.0.2, 3.0.1
612-
613-
614-
- If the issue is not solved by updating the dependencies, a fix has to be
615-
implemented by those dependencies. You can help with that by notifying the
616-
maintainers of this problem (e.g. by creating a bug report) or by proposing a
617-
fix to the maintainers (e.g. by creating a pull request):
618-
619-
620-
- Repository: <not found>
621-
- Detailed warning command: `cargo report future-incompatibilities --id 1 --package [email protected]`
622-
623-
624-
- Repository: <not found>
625-
- Detailed warning command: `cargo report future-incompatibilities --id 1 --package [email protected]`
626-
627-
628-
- Repository: <not found>
629-
- Detailed warning command: `cargo report future-incompatibilities --id 1 --package [email protected]`
630-
631-
- If waiting for an upstream fix is not an option, you can use the `[patch]`
632-
section in `Cargo.toml` to use your own version of the dependency. For more
633-
information, see:
634-
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section
635604
[NOTE] this report can be shown with `cargo report future-incompatibilities --id 1`
605+
To solve this problem, you can try the following approaches:
606+
607+
608+
- Some affected dependencies have newer versions available.
609+
You may want to consider updating them to a newer version to see if the issue has been fixed.
610+
611+
big_update v1.0.0 has the following newer versions available: 2.0.0
612+
with_updates v1.0.0 has the following newer versions available: 1.0.1, 1.0.2, 3.0.1
613+
614+
- If the issue is not solved by updating the dependencies, a fix has to be
615+
implemented by those dependencies. You can help with that by notifying the
616+
maintainers of this problem (e.g. by creating a bug report) or by proposing a
617+
fix to the maintainers (e.g. by creating a pull request):
618+
619+
620+
- Repository: <not found>
621+
- Detailed warning command: `cargo report future-incompatibilities --id 1 --package [email protected]`
622+
623+
624+
- Repository: <not found>
625+
- Detailed warning command: `cargo report future-incompatibilities --id 1 --package [email protected]`
626+
627+
628+
- Repository: <not found>
629+
- Detailed warning command: `cargo report future-incompatibilities --id 1 --package [email protected]`
630+
631+
- If waiting for an upstream fix is not an option, you can use the `[patch]`
632+
section in `Cargo.toml` to use your own version of the dependency. For more
633+
information, see:
634+
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section
635+
636636
637637
"#]].unordered())
638638
.run();
@@ -718,22 +718,22 @@ fn correct_report_id_when_cached() {
718718
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
719719
[WARNING] the following packages contain code that will be rejected by a future version of Rust: bar v1.0.0
720720
[NOTE]
721-
To solve this problem, you can try the following approaches:
722-
723-
- If the issue is not solved by updating the dependencies, a fix has to be
724-
implemented by those dependencies. You can help with that by notifying the
725-
maintainers of this problem (e.g. by creating a bug report) or by proposing a
726-
fix to the maintainers (e.g. by creating a pull request):
727-
728-
729-
- Repository: https://example.com/
730-
- Detailed warning command: `cargo report future-incompatibilities --id 1 --package [email protected]`
731-
732-
- If waiting for an upstream fix is not an option, you can use the `[patch]`
733-
section in `Cargo.toml` to use your own version of the dependency. For more
734-
information, see:
735-
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section
736-
721+
To solve this problem, you can try the following approaches:
722+
723+
- If the issue is not solved by updating the dependencies, a fix has to be
724+
implemented by those dependencies. You can help with that by notifying the
725+
maintainers of this problem (e.g. by creating a bug report) or by proposing a
726+
fix to the maintainers (e.g. by creating a pull request):
727+
728+
729+
- Repository: https://example.com/
730+
- Detailed warning command: `cargo report future-incompatibilities --id 1 --package [email protected]`
731+
732+
- If waiting for an upstream fix is not an option, you can use the `[patch]`
733+
section in `Cargo.toml` to use your own version of the dependency. For more
734+
information, see:
735+
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section
736+
737737
[NOTE] this report can be shown with `cargo report future-incompatibilities --id 1`
738738
739739
"#]])
@@ -745,22 +745,22 @@ https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch
745745
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
746746
[WARNING] the following packages contain code that will be rejected by a future version of Rust: bar v1.0.0
747747
[NOTE]
748-
To solve this problem, you can try the following approaches:
749-
750-
- If the issue is not solved by updating the dependencies, a fix has to be
751-
implemented by those dependencies. You can help with that by notifying the
752-
maintainers of this problem (e.g. by creating a bug report) or by proposing a
753-
fix to the maintainers (e.g. by creating a pull request):
754-
755-
756-
- Repository: https://example.com/
757-
- Detailed warning command: `cargo report future-incompatibilities --id 1 --package [email protected]`
758-
759-
- If waiting for an upstream fix is not an option, you can use the `[patch]`
760-
section in `Cargo.toml` to use your own version of the dependency. For more
761-
information, see:
762-
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section
763-
748+
To solve this problem, you can try the following approaches:
749+
750+
- If the issue is not solved by updating the dependencies, a fix has to be
751+
implemented by those dependencies. You can help with that by notifying the
752+
maintainers of this problem (e.g. by creating a bug report) or by proposing a
753+
fix to the maintainers (e.g. by creating a pull request):
754+
755+
756+
- Repository: https://example.com/
757+
- Detailed warning command: `cargo report future-incompatibilities --id 1 --package [email protected]`
758+
759+
- If waiting for an upstream fix is not an option, you can use the `[patch]`
760+
section in `Cargo.toml` to use your own version of the dependency. For more
761+
information, see:
762+
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section
763+
764764
[NOTE] this report can be shown with `cargo report future-incompatibilities --id 1`
765765
766766
"#]])

tests/testsuite/inheritable_workspace_fields.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ fn inherit_own_workspace_fields() {
168168
[UPLOADING] foo v1.2.3 ([ROOT]/foo)
169169
[UPLOADED] foo v1.2.3 to registry `crates-io`
170170
[NOTE] waiting for foo v1.2.3 to be available at registry `crates-io`.
171-
You may press ctrl-c to skip waiting; the crate should be available shortly.
171+
You may press ctrl-c to skip waiting; the crate should be available shortly.
172172
[PUBLISHED] foo v1.2.3 at registry `crates-io`
173173
174174
"#]])
@@ -335,7 +335,7 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
335335
[UPLOADING] bar v0.2.0 ([ROOT]/foo)
336336
[UPLOADED] bar v0.2.0 to registry `crates-io`
337337
[NOTE] waiting for bar v0.2.0 to be available at registry `crates-io`.
338-
You may press ctrl-c to skip waiting; the crate should be available shortly.
338+
You may press ctrl-c to skip waiting; the crate should be available shortly.
339339
[PUBLISHED] bar v0.2.0 at registry `crates-io`
340340
341341
"#]])
@@ -502,7 +502,7 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
502502
[UPLOADING] bar v0.2.0 ([ROOT]/foo)
503503
[UPLOADED] bar v0.2.0 to registry `crates-io`
504504
[NOTE] waiting for bar v0.2.0 to be available at registry `crates-io`.
505-
You may press ctrl-c to skip waiting; the crate should be available shortly.
505+
You may press ctrl-c to skip waiting; the crate should be available shortly.
506506
[PUBLISHED] bar v0.2.0 at registry `crates-io`
507507
508508
"#]])
@@ -763,7 +763,7 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#the-license-and-lice
763763
[UPLOADING] bar v1.2.3 ([ROOT]/foo/bar)
764764
[UPLOADED] bar v1.2.3 to registry `crates-io`
765765
[NOTE] waiting for bar v1.2.3 to be available at registry `crates-io`.
766-
You may press ctrl-c to skip waiting; the crate should be available shortly.
766+
You may press ctrl-c to skip waiting; the crate should be available shortly.
767767
[PUBLISHED] bar v1.2.3 at registry `crates-io`
768768
769769
"#]])
@@ -937,7 +937,7 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
937937
[UPLOADING] bar v0.2.0 ([ROOT]/foo/bar)
938938
[UPLOADED] bar v0.2.0 to registry `crates-io`
939939
[NOTE] waiting for bar v0.2.0 to be available at registry `crates-io`.
940-
You may press ctrl-c to skip waiting; the crate should be available shortly.
940+
You may press ctrl-c to skip waiting; the crate should be available shortly.
941941
[PUBLISHED] bar v0.2.0 at registry `crates-io`
942942
943943
"#]])

0 commit comments

Comments
 (0)