Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,9 +633,14 @@ fn normalize_package_toml<'a>(
if is_embedded {
const DEFAULT_EDITION: crate::core::features::Edition =
crate::core::features::Edition::LATEST_STABLE;
let report = [Group::with_title(Level::WARNING.secondary_title(format!(
let mut report = vec![Group::with_title(Level::WARNING.secondary_title(format!(
"`package.edition` is unspecified, defaulting to the latest edition (currently `{DEFAULT_EDITION}`)"
)))];
if !matches!(gctx.shell().verbosity(), cargo_util_terminal::Verbosity::Quiet) {
report.push(Group::with_title(Level::HELP.secondary_title(format!(
"to pin the edition, run `cargo fix --manifest-path {}`", manifest_file.display()
))));
}
let _ = gctx.shell().print_report(&report, true);
Some(manifest::InheritableField::Value(
DEFAULT_EDITION.to_string(),
Expand Down
17 changes: 11 additions & 6 deletions tests/testsuite/cargo_add/script_bare/stderr.term.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 11 additions & 6 deletions tests/testsuite/cargo_add/script_frontmatter_empty/stderr.term.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 11 additions & 6 deletions tests/testsuite/cargo_add/script_shebang/stderr.term.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 9 additions & 4 deletions tests/testsuite/cargo_remove/script/stderr.term.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 9 additions & 4 deletions tests/testsuite/cargo_remove/script_last/stderr.term.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions tests/testsuite/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3091,6 +3091,7 @@ fn script_without_frontmatter() {
.with_stdout_data(str![""])
.with_stderr_data(str![[r#"
[WARNING] `package.edition` is unspecified, defaulting to the latest edition (currently `[..]`)
[HELP] to pin the edition, run `cargo fix --manifest-path [ROOT]/foo/echo.rs`
[FIXED] echo.rs (1 fix)
[CHECKING] echo v0.0.0 ([ROOT]/foo/echo.rs)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
Expand Down Expand Up @@ -3129,6 +3130,7 @@ fn main() {}",
.with_stdout_data(str![""])
.with_stderr_data(str![[r#"
[WARNING] `package.edition` is unspecified, defaulting to the latest edition (currently `[..]`)
[HELP] to pin the edition, run `cargo fix --manifest-path [ROOT]/foo/echo.rs`
[FIXED] echo.rs (1 fix)
[CHECKING] echo v0.0.0 ([ROOT]/foo/echo.rs)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
Expand Down Expand Up @@ -3169,6 +3171,7 @@ fn main() {}"#,
.with_stdout_data(str![""])
.with_stderr_data(str![[r#"
[WARNING] `package.edition` is unspecified, defaulting to the latest edition (currently `[..]`)
[HELP] to pin the edition, run `cargo fix --manifest-path [ROOT]/foo/echo.rs`
[FIXED] echo.rs (1 fix)
[CHECKING] foo v0.0.0 ([ROOT]/foo/echo.rs)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
Expand Down Expand Up @@ -3208,6 +3211,7 @@ fn main() {}"#,
.with_stdout_data(str![""])
.with_stderr_data(str![[r#"
[WARNING] `package.edition` is unspecified, defaulting to the latest edition (currently `[..]`)
[HELP] to pin the edition, run `cargo fix --manifest-path [ROOT]/foo/echo.rs`
[FIXED] echo.rs (1 fix)
[CHECKING] foo v0.0.0 ([ROOT]/foo/echo.rs)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
Expand Down
1 change: 1 addition & 0 deletions tests/testsuite/lints/non_kebab_case_bins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ fn main() {}"#,
.masquerade_as_nightly_cargo(&["cargo-lints", "script"])
.with_stderr_data(str![[r#"
[WARNING] `package.edition` is unspecified, defaulting to the latest edition (currently `[..]`)
[HELP] to pin the edition, run `cargo fix --manifest-path [ROOT]/foo/foo_bar`
[WARNING] binaries should have a kebab-case name
|
1 | [ROOT]/home/.cargo/build/[HASH]/target/.../foo_bar[EXE]
Expand Down
1 change: 1 addition & 0 deletions tests/testsuite/lints/non_kebab_case_packages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ fn main() {}"#,
.masquerade_as_nightly_cargo(&["cargo-lints", "script"])
.with_stderr_data(str![[r#"
[WARNING] `package.edition` is unspecified, defaulting to the latest edition (currently `[..]`)
[HELP] to pin the edition, run `cargo fix --manifest-path [ROOT]/foo/foo_bar`
[WARNING] packages should have a kebab-case name
--> foo_bar
= [NOTE] `cargo::non_kebab_case_packages` is set to `warn` in `[lints]`
Expand Down
1 change: 1 addition & 0 deletions tests/testsuite/lints/non_snake_case_packages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ fn main() {}"#,
.masquerade_as_nightly_cargo(&["cargo-lints", "script"])
.with_stderr_data(str![[r#"
[WARNING] `package.edition` is unspecified, defaulting to the latest edition (currently `[..]`)
[HELP] to pin the edition, run `cargo fix --manifest-path [ROOT]/foo/foo-bar`
[WARNING] packages should have a snake-case name
--> foo-bar
= [NOTE] `cargo::non_snake_case_packages` is set to `warn` in `[lints]`
Expand Down
1 change: 1 addition & 0 deletions tests/testsuite/lockfile_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ fn config_run_embed() {
.with_status(101)
.with_stderr_data(str![[r#"
[WARNING] `package.edition` is unspecified, defaulting to the latest edition (currently `[..]`)
[HELP] to pin the edition, run `cargo fix --manifest-path [ROOT]/foo/src/main.rs`
[ERROR] failed to parse lock file at: [ROOT]/foo/Cargo.lock
...
"#]])
Expand Down
Loading