diff --git a/src/diagnostics/lint.rs b/src/diagnostics/lint.rs index 94c382f2e8e..02f2d99e9ce 100644 --- a/src/diagnostics/lint.rs +++ b/src/diagnostics/lint.rs @@ -11,7 +11,6 @@ use crate::workspace::{Feature, Features}; #[derive(Clone, Debug)] pub struct Lint { pub name: &'static str, - pub desc: &'static str, pub primary_group: &'static LintGroup, /// The minimum supported Rust version for applying this lint /// @@ -239,7 +238,6 @@ mod tests { fn test_lint(name: &'static str, group: &'static LintGroup) -> Lint { Lint { name, - desc: "test lint", primary_group: group, msrv: None, feature_gate: None, diff --git a/src/diagnostics/rules/blanket_hint_mostly_unused.rs b/src/diagnostics/rules/blanket_hint_mostly_unused.rs index cc2b5945165..9aead613006 100644 --- a/src/diagnostics/rules/blanket_hint_mostly_unused.rs +++ b/src/diagnostics/rules/blanket_hint_mostly_unused.rs @@ -22,7 +22,6 @@ use crate::workspace::Workspace; pub static LINT: &Lint = &Lint { name: "blanket_hint_mostly_unused", - desc: "blanket_hint_mostly_unused lint", primary_group: &SUSPICIOUS, msrv: Some(super::CARGO_LINTS_MSRV), feature_gate: None, diff --git a/src/diagnostics/rules/im_a_teapot.rs b/src/diagnostics/rules/im_a_teapot.rs index 97779770883..faa9e287d78 100644 --- a/src/diagnostics/rules/im_a_teapot.rs +++ b/src/diagnostics/rules/im_a_teapot.rs @@ -22,7 +22,6 @@ use crate::workspace::Workspace; /// This lint is only to be used for testing purposes pub static LINT: &Lint = &Lint { name: "im_a_teapot", - desc: "`im_a_teapot` is specified", primary_group: &TEST_DUMMY_UNSTABLE, msrv: None, feature_gate: Some(Feature::test_dummy_unstable()), @@ -53,7 +52,7 @@ pub(crate) fn lint_package( let manifest_path = workspace_rel_path(ws, path); let emitted_source = LINT.emitted_source(lint_level, source); - let mut desc = Group::with_title(level.primary_title(LINT.desc)); + let mut desc = Group::with_title(level.primary_title("`im_a_teapot` is specified")); if let Some(document) = manifest.document() && let Some(contents) = manifest.contents() diff --git a/src/diagnostics/rules/manual_readme.rs b/src/diagnostics/rules/manual_readme.rs index fc049b504db..5c9cb2bc4d4 100644 --- a/src/diagnostics/rules/manual_readme.rs +++ b/src/diagnostics/rules/manual_readme.rs @@ -26,7 +26,6 @@ use crate::workspace::parser::default_readme_from_package_root; pub static LINT: &Lint = &Lint { name: "manual_readme", - desc: "explicit `package.readme` can be inferred", primary_group: &STYLE, msrv: Some(super::CARGO_LINTS_MSRV), feature_gate: None, @@ -121,7 +120,8 @@ fn lint_package_inner( let level = lint_level.to_diagnostic_level(); let emitted_source = LINT.emitted_source(lint_level, source); - let mut primary = Group::with_title(level.primary_title(LINT.desc)); + let mut primary = + Group::with_title(level.primary_title("explicit `package.readme` can be inferred")); if let Some(document) = document && let Some(contents) = contents && let Some(span) = get_key_value_span(document, &["package", "readme"]) diff --git a/src/diagnostics/rules/missing_lints_inheritance.rs b/src/diagnostics/rules/missing_lints_inheritance.rs index 926684fb5bd..b2e521079a0 100644 --- a/src/diagnostics/rules/missing_lints_inheritance.rs +++ b/src/diagnostics/rules/missing_lints_inheritance.rs @@ -19,7 +19,6 @@ use crate::workspace::Workspace; pub static LINT: &Lint = &Lint { name: "missing_lints_inheritance", - desc: "missing `[lints]` to inherit `[workspace.lints]`", primary_group: &SUSPICIOUS, msrv: Some(super::CARGO_LINTS_MSRV), feature_gate: None, @@ -97,7 +96,8 @@ pub(crate) fn lint_package( let emitted_source = LINT.emitted_source(lint_level, source); let manifest_path = workspace_rel_path(ws, manifest_path); - let mut primary = Group::with_title(level.primary_title(LINT.desc)); + let mut primary = + Group::with_title(level.primary_title("missing `[lints]` to inherit `[workspace.lints]`")); primary = primary.element(Origin::path(&manifest_path)); primary = primary.element(Level::NOTE.message(emitted_source)); let mut report = vec![primary]; diff --git a/src/diagnostics/rules/non_kebab_case_bins.rs b/src/diagnostics/rules/non_kebab_case_bins.rs index e66d9b91997..beb0d3d6707 100644 --- a/src/diagnostics/rules/non_kebab_case_bins.rs +++ b/src/diagnostics/rules/non_kebab_case_bins.rs @@ -24,7 +24,6 @@ use crate::workspace::Workspace; pub static LINT: &Lint = &Lint { name: "non_kebab_case_bins", - desc: "binaries should have a kebab-case name", primary_group: &STYLE, msrv: Some(super::CARGO_LINTS_MSRV), feature_gate: None, @@ -116,12 +115,14 @@ fn lint_package_inner( let primary_span_end = primary_span_start + original_name.len(); primary_source.push_str(original_name); primary_source.push_str(std::env::consts::EXE_SUFFIX); - let mut primary_group = - level - .primary_title(LINT.desc) - .element(Snippet::source(&primary_source).annotation( - AnnotationKind::Primary.span(primary_span_start..primary_span_end), - )); + let mut primary_group = level + .primary_title(format!( + "binary `{original_name}` should have a kebab-case name" + )) + .element( + Snippet::source(&primary_source) + .annotation(AnnotationKind::Primary.span(primary_span_start..primary_span_end)), + ); if i == 0 { primary_group = primary_group.element(Level::NOTE.message(emitted_source)); } @@ -134,10 +135,9 @@ fn lint_package_inner( .enumerate() .find(|(_i, t)| t.name.as_deref() == Some(original_name)) { - let mut help = Group::with_title( - Level::HELP - .secondary_title("to change the binary name to kebab case, convert `bin.name`"), - ); + let mut help = Group::with_title(Level::HELP.secondary_title(format!( + "to change the binary name to `{kebab_case}`, convert `bin.name`" + ))); if let Some(document) = document && let Some(contents) = contents && let Some(span) = get_key_value_span( @@ -169,11 +169,12 @@ fn lint_package_inner( // Showing package in case this is done before first publish to fix the problem at the // root let help_package_name = - "to change the binary name to kebab case, convert `package.name`"; + format!("to change the binary name to `{kebab_case}`, convert `package.name`"); // Including `[[bin]]` in case it is already published. // Preferring it over moving the file to avoid having to get into moving the // files it `mod`s - let help_bin_table = "to change the binary name to kebab case, specify `bin.name`"; + let help_bin_table = + format!("to change the binary name to `{kebab_case}`, specify `bin.name`"); if let Some(document) = document && let Some(contents) = contents && let Some(span) = get_key_value_span(document, &["package", "name"]) @@ -230,7 +231,9 @@ path = "src/main.rs""# }) .unwrap_or(0); let help = Level::HELP - .secondary_title("to change the binary name to kebab case, convert the file stem") + .secondary_title(format!( + "to change the binary name to `{kebab_case}`, convert the file stem" + )) .element(Snippet::source(display_path).patch(Patch::new(start..end, kebab_case))); report.push(help); } diff --git a/src/diagnostics/rules/non_kebab_case_features.rs b/src/diagnostics/rules/non_kebab_case_features.rs index f086eb2e80b..f49f7f91b27 100644 --- a/src/diagnostics/rules/non_kebab_case_features.rs +++ b/src/diagnostics/rules/non_kebab_case_features.rs @@ -23,7 +23,6 @@ use crate::workspace::Workspace; pub static LINT: &Lint = &Lint { name: "non_kebab_case_features", - desc: "features should have a kebab-case name", primary_group: &RESTRICTION, msrv: None, feature_gate: None, @@ -98,7 +97,9 @@ fn lint_package_inner( let level = lint_level.to_diagnostic_level(); let emitted_source = LINT.emitted_source(lint_level, source); - let mut primary = Group::with_title(level.primary_title(LINT.desc)); + let mut primary = Group::with_title(level.primary_title(format!( + "feature `{original_name}` should have a kebab-case name" + ))); if let Some(document) = document && let Some(contents) = contents && let Some(span) = get_key_value_span(document, &["features", original_name]) @@ -133,9 +134,9 @@ fn lint_package_inner( && let Some(contents) = contents && let Some(span) = get_key_value_span(document, &["features", original_name]) { - let mut help = Group::with_title(Level::HELP.secondary_title( - "to change the feature name to kebab case, convert the `features` key", - )); + let mut help = Group::with_title(Level::HELP.secondary_title(format!( + "to change the feature name to `{kebab_case}`, convert the `features` key" + ))); help = help.element( Snippet::source(contents) .path(manifest_path) diff --git a/src/diagnostics/rules/non_kebab_case_packages.rs b/src/diagnostics/rules/non_kebab_case_packages.rs index 036beabcfe2..d26e6103768 100644 --- a/src/diagnostics/rules/non_kebab_case_packages.rs +++ b/src/diagnostics/rules/non_kebab_case_packages.rs @@ -23,7 +23,6 @@ use crate::workspace::Workspace; pub static LINT: &Lint = &Lint { name: "non_kebab_case_packages", - desc: "packages should have a kebab-case name", primary_group: &RESTRICTION, msrv: None, feature_gate: None, @@ -98,7 +97,9 @@ fn lint_package_inner( let level = lint_level.to_diagnostic_level(); let emitted_source = LINT.emitted_source(lint_level, source); - let mut primary = Group::with_title(level.primary_title(LINT.desc)); + let mut primary = Group::with_title(level.primary_title(format!( + "package `{original_name}` should have a kebab-case name" + ))); if let Some(document) = document && let Some(contents) = contents && let Some(span) = get_key_value_span(document, &["package", "name"]) @@ -117,10 +118,9 @@ fn lint_package_inner( && let Some(contents) = contents && let Some(span) = get_key_value_span(document, &["package", "name"]) { - let mut help = - Group::with_title(Level::HELP.secondary_title( - "to change the package name to kebab case, convert `package.name`", - )); + let mut help = Group::with_title(Level::HELP.secondary_title(format!( + "to change the package name to `{kebab_case}`, convert `package.name`" + ))); help = help.element( Snippet::source(contents) .path(manifest_path) @@ -140,7 +140,9 @@ fn lint_package_inner( }) .unwrap_or(0); let help = Level::HELP - .secondary_title("to change the package name to kebab case, convert the file stem") + .secondary_title(format!( + "to change the package name to `{kebab_case}`, convert the file stem" + )) .element(Snippet::source(display_path).patch(Patch::new(start..end, kebab_case))); report.push(help); } diff --git a/src/diagnostics/rules/non_snake_case_features.rs b/src/diagnostics/rules/non_snake_case_features.rs index 44ed5ef4a39..ea6f75f8f57 100644 --- a/src/diagnostics/rules/non_snake_case_features.rs +++ b/src/diagnostics/rules/non_snake_case_features.rs @@ -23,7 +23,6 @@ use crate::workspace::Workspace; pub static LINT: &Lint = &Lint { name: "non_snake_case_features", - desc: "features should have a snake-case name", primary_group: &RESTRICTION, msrv: None, feature_gate: None, @@ -98,7 +97,9 @@ fn lint_package_inner( let level = lint_level.to_diagnostic_level(); let emitted_source = LINT.emitted_source(lint_level, source); - let mut primary = Group::with_title(level.primary_title(LINT.desc)); + let mut primary = Group::with_title(level.primary_title(format!( + "feature `{original_name}` should have a snake-case name" + ))); if let Some(document) = document && let Some(contents) = contents && let Some(span) = get_key_value_span(document, &["features", original_name]) @@ -133,9 +134,9 @@ fn lint_package_inner( && let Some(contents) = contents && let Some(span) = get_key_value_span(document, &["features", original_name]) { - let mut help = Group::with_title(Level::HELP.secondary_title( - "to change the feature name to snake case, convert the `features` key", - )); + let mut help = Group::with_title(Level::HELP.secondary_title(format!( + "to change the feature name to `{snake_case}`, convert the `features` key" + ))); help = help.element( Snippet::source(contents) .path(manifest_path) diff --git a/src/diagnostics/rules/non_snake_case_packages.rs b/src/diagnostics/rules/non_snake_case_packages.rs index 76ddb4f558d..d514a87db5d 100644 --- a/src/diagnostics/rules/non_snake_case_packages.rs +++ b/src/diagnostics/rules/non_snake_case_packages.rs @@ -23,7 +23,6 @@ use crate::workspace::Workspace; pub static LINT: &Lint = &Lint { name: "non_snake_case_packages", - desc: "packages should have a snake-case name", primary_group: &RESTRICTION, msrv: None, feature_gate: None, @@ -98,7 +97,9 @@ fn lint_package_inner( let level = lint_level.to_diagnostic_level(); let emitted_source = LINT.emitted_source(lint_level, source); - let mut primary = Group::with_title(level.primary_title(LINT.desc)); + let mut primary = Group::with_title(level.primary_title(format!( + "package `{original_name}` should have a snake-case name" + ))); if let Some(document) = document && let Some(contents) = contents && let Some(span) = get_key_value_span(document, &["package", "name"]) @@ -117,10 +118,9 @@ fn lint_package_inner( && let Some(contents) = contents && let Some(span) = get_key_value_span(document, &["package", "name"]) { - let mut help = - Group::with_title(Level::HELP.secondary_title( - "to change the package name to snake case, convert `package.name`", - )); + let mut help = Group::with_title(Level::HELP.secondary_title(format!( + "to change the package name to `{snake_case}`, convert `package.name`" + ))); help = help.element( Snippet::source(contents) .path(manifest_path) @@ -140,7 +140,9 @@ fn lint_package_inner( }) .unwrap_or(0); let help = Level::HELP - .secondary_title("to change the package name to snake case, convert the file stem") + .secondary_title(format!( + "to change the package name to `{snake_case}`, convert the file stem" + )) .element(Snippet::source(display_path).patch(Patch::new(start..end, snake_case))); report.push(help); } diff --git a/src/diagnostics/rules/redundant_homepage.rs b/src/diagnostics/rules/redundant_homepage.rs index 18a592249ba..bd8c17a185c 100644 --- a/src/diagnostics/rules/redundant_homepage.rs +++ b/src/diagnostics/rules/redundant_homepage.rs @@ -23,7 +23,6 @@ use crate::workspace::Workspace; pub static LINT: &Lint = &Lint { name: "redundant_homepage", - desc: "`package.homepage` is redundant with another manifest field", primary_group: &STYLE, msrv: Some(super::CARGO_LINTS_MSRV), feature_gate: None, @@ -114,7 +113,9 @@ fn lint_package_inner( let level = lint_level.to_diagnostic_level(); let emitted_source = LINT.emitted_source(lint_level, source); - let mut primary = Group::with_title(level.primary_title(LINT.desc)); + let mut primary = Group::with_title(level.primary_title(format!( + "`package.homepage` is redundant with `package.{other_field}`" + ))); if let Some(document) = document && let Some(contents) = contents && let Some(span) = get_key_value_span(document, &["package", "homepage"]) diff --git a/src/diagnostics/rules/text_direction_codepoint_in_comment.rs b/src/diagnostics/rules/text_direction_codepoint_in_comment.rs index 3f25452bdd8..a279409a742 100644 --- a/src/diagnostics/rules/text_direction_codepoint_in_comment.rs +++ b/src/diagnostics/rules/text_direction_codepoint_in_comment.rs @@ -25,7 +25,6 @@ use crate::workspace::Workspace; pub static LINT: &Lint = &Lint { name: "text_direction_codepoint_in_comment", - desc: "unicode codepoint changing visible direction of text present in comment", primary_group: &CORRECTNESS, msrv: Some(super::CARGO_LINTS_MSRV), feature_gate: None, @@ -107,7 +106,10 @@ pub(crate) fn lint_manifest( } let level = lint_level.to_diagnostic_level(); - let mut primary = Group::with_title(level.primary_title(LINT.desc)).element(snippet); + let mut primary = Group::with_title(level.primary_title( + "unicode codepoint changing visible direction of text present in comment", + )) + .element(snippet); if emitted_source.is_none() { emitted_source = Some(LINT.emitted_source(lint_level, source)); primary = primary.element(Level::NOTE.message(emitted_source.as_ref().unwrap())); diff --git a/src/diagnostics/rules/text_direction_codepoint_in_literal.rs b/src/diagnostics/rules/text_direction_codepoint_in_literal.rs index 5cef88267f9..a826947deb8 100644 --- a/src/diagnostics/rules/text_direction_codepoint_in_literal.rs +++ b/src/diagnostics/rules/text_direction_codepoint_in_literal.rs @@ -26,7 +26,6 @@ use crate::workspace::Workspace; pub static LINT: &Lint = &Lint { name: "text_direction_codepoint_in_literal", - desc: "unicode codepoint changing visible direction of text present in literal", primary_group: &CORRECTNESS, msrv: Some(super::CARGO_LINTS_MSRV), feature_gate: None, @@ -148,7 +147,10 @@ pub(crate) fn lint_manifest( } let level = lint_level.to_diagnostic_level(); - let mut primary = Group::with_title(level.primary_title(LINT.desc)).element(snippet); + let mut primary = Group::with_title(level.primary_title( + "unicode codepoint changing visible direction of text present in literal", + )) + .element(snippet); if emitted_source.is_none() { emitted_source = Some(LINT.emitted_source(lint_level, source)); primary = primary.element(Level::NOTE.message(emitted_source.as_ref().unwrap())); diff --git a/src/diagnostics/rules/unknown_lints.rs b/src/diagnostics/rules/unknown_lints.rs index 70f7664d5a4..c9c8f527ea8 100644 --- a/src/diagnostics/rules/unknown_lints.rs +++ b/src/diagnostics/rules/unknown_lints.rs @@ -25,7 +25,6 @@ use crate::workspace::Workspace; pub static LINT: &Lint = &Lint { name: "unknown_lints", - desc: "unknown lint", primary_group: &SUSPICIOUS, msrv: Some(super::CARGO_LINTS_MSRV), feature_gate: None, @@ -136,7 +135,7 @@ fn lint_manifest_inner( let level = lint_level.to_diagnostic_level(); let mut emitted_source = None; for lint_name in unknown_lints { - let title = format!("{}: `{lint_name}`", LINT.desc); + let title = format!("unknown lint: `{lint_name}`"); let underscore_lint_name = lint_name.replace("-", "_"); let matching = if let Some(lint) = LINTS.iter().find(|l| l.name == underscore_lint_name) { Some((lint.name, "lint")) diff --git a/src/diagnostics/rules/unused_dependencies.rs b/src/diagnostics/rules/unused_dependencies.rs index 1016fce3c8b..d1fe089af23 100644 --- a/src/diagnostics/rules/unused_dependencies.rs +++ b/src/diagnostics/rules/unused_dependencies.rs @@ -33,7 +33,6 @@ use crate::workspace::dependency::DepKind; pub static LINT: &Lint = &Lint { name: "unused_dependencies", - desc: "unused dependency", primary_group: &STYLE, msrv: Some(super::CARGO_LINTS_MSRV), feature_gate: None, @@ -131,7 +130,8 @@ pub(crate) fn lint_package( let level = lint_level.to_diagnostic_level(); let emitted_source = LINT.emitted_source(lint_level, source); - let mut primary = Group::with_title(level.primary_title(LINT.desc)); + let mut primary = + Group::with_title(level.primary_title(format!("unused build dependency `{dep_name}`"))); if let Some(document) = document && let Some(contents) = contents && let Some(span) = get_key_value_span(document, &["build-dependencies", dep_name]) @@ -150,7 +150,8 @@ pub(crate) fn lint_package( } let mut report = vec![primary]; let help = Group::with_title( - Level::HELP.secondary_title("consider removing the unused dependency"), + Level::HELP + .secondary_title(format!("consider removing the dependency on `{dep_name}`")), ); report.push(help); @@ -306,8 +307,11 @@ fn lint_package_build_results( let level = lint_level.to_diagnostic_level(); let emitted_source = LINT.emitted_source(lint_level, source); let toml_path = dependency.toml_path(); + let dep_name = toml_path.last().unwrap(); - let mut primary = Group::with_title(level.primary_title(LINT.desc)); + let mut primary = Group::with_title( + level.primary_title(format!("unused dependency `{dep_name}`")), + ); if let Some(document) = document && let Some(contents) = contents && let Some(span) = get_key_value_span(document, &toml_path) @@ -326,9 +330,10 @@ fn lint_package_build_results( } lint_count += 1; let mut report = vec![primary]; - let help = Group::with_title( - Level::HELP.secondary_title("consider removing the unused dependency"), - ); + let help = + Group::with_title(Level::HELP.secondary_title(format!( + "consider removing the dependency on `{dep_name}`" + ))); report.push(help); if used_in_dev { let help = Group::with_title(Level::HELP.secondary_title( diff --git a/src/diagnostics/rules/unused_workspace_dependencies.rs b/src/diagnostics/rules/unused_workspace_dependencies.rs index e4b4d9c33f6..ecec285704a 100644 --- a/src/diagnostics/rules/unused_workspace_dependencies.rs +++ b/src/diagnostics/rules/unused_workspace_dependencies.rs @@ -22,7 +22,6 @@ use crate::workspace::Workspace; pub static LINT: &Lint = &Lint { name: "unused_workspace_dependencies", - desc: "unused workspace dependency", primary_group: &SUSPICIOUS, msrv: Some(super::CARGO_LINTS_MSRV), feature_gate: None, @@ -131,7 +130,9 @@ pub(crate) fn lint_workspace( let manifest_path = workspace_rel_path(ws, manifest_path); let emitted_source = LINT.emitted_source(lint_level, source); - let mut primary = Group::with_title(level.primary_title(LINT.desc)); + let mut primary = Group::with_title( + level.primary_title(format!("unused workspace dependency `{unused}`")), + ); if let Some(document) = document && let Some(contents) = contents { @@ -149,9 +150,9 @@ pub(crate) fn lint_workspace( primary = primary.element(Level::NOTE.message(emitted_source)); } let mut report = vec![primary]; - let help = Group::with_title( - Level::HELP.secondary_title("consider removing the unused workspace dependency"), - ); + let help = Group::with_title(Level::HELP.secondary_title(format!( + "consider removing the workspace dependency `{unused}`" + ))); report.push(help); pkg_stats.record_lint(lint_level); diff --git a/src/diagnostics/rules/unused_workspace_package_fields.rs b/src/diagnostics/rules/unused_workspace_package_fields.rs index 9f80a0181f2..30565d0e069 100644 --- a/src/diagnostics/rules/unused_workspace_package_fields.rs +++ b/src/diagnostics/rules/unused_workspace_package_fields.rs @@ -21,7 +21,6 @@ use crate::workspace::Workspace; pub static LINT: &Lint = &Lint { name: "unused_workspace_package_fields", - desc: "unused field in `workspace.package`", primary_group: &SUSPICIOUS, msrv: Some(super::CARGO_LINTS_MSRV), feature_gate: None, @@ -100,7 +99,9 @@ pub(crate) fn lint_workspace( let manifest_path = workspace_rel_path(ws, manifest_path); let emitted_source = LINT.emitted_source(lint_level, source); - let mut primary = Group::with_title(level.primary_title(LINT.desc)); + let mut primary = Group::with_title( + level.primary_title(format!("unused field `{unused}` in `workspace.package`")), + ); if let Some(document) = document && let Some(contents) = contents { @@ -118,8 +119,9 @@ pub(crate) fn lint_workspace( primary = primary.element(Level::NOTE.message(emitted_source)); } let mut report = vec![primary]; - let help = - Group::with_title(Level::HELP.secondary_title("consider removing the unused field")); + let help = Group::with_title(Level::HELP.secondary_title(format!( + "consider removing the field `workspace.package.{unused}`" + ))); report.push(help); pkg_stats.record_lint(lint_level); diff --git a/tests/testsuite/lints/mod.rs b/tests/testsuite/lints/mod.rs index bf21c84259a..500d122682b 100644 --- a/tests/testsuite/lints/mod.rs +++ b/tests/testsuite/lints/mod.rs @@ -472,7 +472,7 @@ fn explicit_lint_level_overrides_default() { .masquerade_as_nightly_cargo(&["cargo-lints"]) .with_status(101) .with_stderr_data(str![[r#" -[ERROR] `package.homepage` is redundant with another manifest field +[ERROR] `package.homepage` is redundant with `package.repository` --> Cargo.toml:8:24 | 7 | repository = "https://github.com/rust-lang/cargo/" diff --git a/tests/testsuite/lints/non_kebab_case_bins.rs b/tests/testsuite/lints/non_kebab_case_bins.rs index ee2d12431f7..bd4e487ef78 100644 --- a/tests/testsuite/lints/non_kebab_case_bins.rs +++ b/tests/testsuite/lints/non_kebab_case_bins.rs @@ -29,13 +29,13 @@ non_kebab_case_bins = "warn" p.cargo("fetch -Zcargo-lints") .masquerade_as_nightly_cargo(&["cargo-lints"]) .with_stderr_data(str![[r#" -[WARNING] binaries should have a kebab-case name +[WARNING] binary `foo_bar` should have a kebab-case name | 1 | [ROOT]/foo/target/.../foo_bar[EXE] | [..]^^^^^^^ | = [NOTE] `cargo::non_kebab_case_bins` is set to `warn` in `[lints]` -[HELP] to change the binary name to kebab case, convert `bin.name` +[HELP] to change the binary name to `foo-bar`, convert `bin.name` --> Cargo.toml:9:8 | 9 - name = "foo_bar" @@ -70,19 +70,19 @@ non_kebab_case_bins = "warn" p.cargo("fetch -Zcargo-lints") .masquerade_as_nightly_cargo(&["cargo-lints"]) .with_stderr_data(str![[r#" -[WARNING] binaries should have a kebab-case name +[WARNING] binary `foo_bar` should have a kebab-case name | 1 | [ROOT]/foo/target/.../foo_bar[EXE] | [..]^^^^^^^ | = [NOTE] `cargo::non_kebab_case_bins` is set to `warn` in `[lints]` -[HELP] to change the binary name to kebab case, convert `package.name` +[HELP] to change the binary name to `foo-bar`, convert `package.name` --> Cargo.toml:3:8 | 3 - name = "foo_bar" 3 + name = "foo-bar" | -[HELP] to change the binary name to kebab case, specify `bin.name` +[HELP] to change the binary name to `foo-bar`, specify `bin.name` --> Cargo.toml:10:30 | 10 ~ non_kebab_case_bins = "warn" @@ -119,13 +119,13 @@ non_kebab_case_bins = "warn" p.cargo("fetch -Zcargo-lints") .masquerade_as_nightly_cargo(&["cargo-lints"]) .with_stderr_data(str![[r#" -[WARNING] binaries should have a kebab-case name +[WARNING] binary `foo_bar` should have a kebab-case name | 1 | [ROOT]/foo/target/.../foo_bar[EXE] | [..]^^^^^^^ | = [NOTE] `cargo::non_kebab_case_bins` is set to `warn` in `[lints]` -[HELP] to change the binary name to kebab case, convert the file stem +[HELP] to change the binary name to `foo-bar`, convert the file stem | 1 - src/bin/foo_bar.rs 1 + src/bin/foo-bar.rs @@ -156,13 +156,13 @@ fn main() {}"#, .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 +[WARNING] binary `foo_bar` should have a kebab-case name | 1 | [ROOT]/home/.cargo/build/[HASH]/target/.../foo_bar[EXE] | [..]^^^^^^^ | = [NOTE] `cargo::non_kebab_case_bins` is set to `warn` in `[lints]` -[HELP] to change the binary name to kebab case, convert the file stem +[HELP] to change the binary name to `foo-bar`, convert the file stem | 1 - foo_bar 1 + foo-bar diff --git a/tests/testsuite/lints/non_kebab_case_features.rs b/tests/testsuite/lints/non_kebab_case_features.rs index 4691d715ca2..4f39ae26275 100644 --- a/tests/testsuite/lints/non_kebab_case_features.rs +++ b/tests/testsuite/lints/non_kebab_case_features.rs @@ -29,14 +29,14 @@ non_kebab_case_features = "warn" foo.cargo("fetch -Zcargo-lints") .masquerade_as_nightly_cargo(&["cargo-lints", "test-dummy-unstable"]) .with_stderr_data(str![[r#" -[WARNING] features should have a kebab-case name +[WARNING] feature `foo_bar` should have a kebab-case name --> Cargo.toml:9:1 | 9 | foo_bar = [] | ^^^^^^^ | = [NOTE] `cargo::non_kebab_case_features` is set to `warn` in `[lints]` -[HELP] to change the feature name to kebab case, convert the `features` key +[HELP] to change the feature name to `foo-bar`, convert the `features` key | 9 - foo_bar = [] 9 + foo-bar = [] @@ -75,7 +75,7 @@ non_kebab_case_features = "warn" foo.cargo("fetch -Zcargo-lints") .masquerade_as_nightly_cargo(&["cargo-lints", "test-dummy-unstable"]) .with_stderr_data(str![[r#" -[WARNING] features should have a kebab-case name +[WARNING] feature `foo_bar` should have a kebab-case name --> Cargo.toml:9:1 | 9 | foo_bar = { version = "0.0.1", optional = true } diff --git a/tests/testsuite/lints/non_kebab_case_packages.rs b/tests/testsuite/lints/non_kebab_case_packages.rs index c483d1375bc..070c8325913 100644 --- a/tests/testsuite/lints/non_kebab_case_packages.rs +++ b/tests/testsuite/lints/non_kebab_case_packages.rs @@ -25,14 +25,14 @@ non_kebab_case_packages = "warn" foo.cargo("fetch -Zcargo-lints") .masquerade_as_nightly_cargo(&["cargo-lints", "test-dummy-unstable"]) .with_stderr_data(str![[r#" -[WARNING] packages should have a kebab-case name +[WARNING] package `foo_bar` should have a kebab-case name --> Cargo.toml:3:8 | 3 | name = "foo_bar" | ^^^^^^^^^ | = [NOTE] `cargo::non_kebab_case_packages` is set to `warn` in `[lints]` -[HELP] to change the package name to kebab case, convert `package.name` +[HELP] to change the package name to `foo-bar`, convert `package.name` | 3 - name = "foo_bar" 3 + name = "foo-bar" @@ -63,10 +63,10 @@ fn main() {}"#, .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 +[WARNING] package `foo_bar` should have a kebab-case name --> foo_bar = [NOTE] `cargo::non_kebab_case_packages` is set to `warn` in `[lints]` -[HELP] to change the package name to kebab case, convert the file stem +[HELP] to change the package name to `foo-bar`, convert the file stem | 1 - [ROOT]/foo/foo_bar 1 + [ROOT]/foo/foo-bar diff --git a/tests/testsuite/lints/non_snake_case_features.rs b/tests/testsuite/lints/non_snake_case_features.rs index be1d47415c9..da53cb239d9 100644 --- a/tests/testsuite/lints/non_snake_case_features.rs +++ b/tests/testsuite/lints/non_snake_case_features.rs @@ -29,14 +29,14 @@ non_snake_case_features = "warn" foo.cargo("fetch -Zcargo-lints") .masquerade_as_nightly_cargo(&["cargo-lints", "test-dummy-unstable"]) .with_stderr_data(str![[r#" -[WARNING] features should have a snake-case name +[WARNING] feature `foo-bar` should have a snake-case name --> Cargo.toml:9:1 | 9 | foo-bar = [] | ^^^^^^^ | = [NOTE] `cargo::non_snake_case_features` is set to `warn` in `[lints]` -[HELP] to change the feature name to snake case, convert the `features` key +[HELP] to change the feature name to `foo_bar`, convert the `features` key | 9 - foo-bar = [] 9 + foo_bar = [] @@ -75,7 +75,7 @@ non_snake_case_features = "warn" foo.cargo("fetch -Zcargo-lints") .masquerade_as_nightly_cargo(&["cargo-lints", "test-dummy-unstable"]) .with_stderr_data(str![[r#" -[WARNING] features should have a snake-case name +[WARNING] feature `foo-bar` should have a snake-case name --> Cargo.toml:9:1 | 9 | foo-bar = { version = "0.0.1", optional = true } diff --git a/tests/testsuite/lints/non_snake_case_packages.rs b/tests/testsuite/lints/non_snake_case_packages.rs index c61e3c37c38..ce8b5d972b8 100644 --- a/tests/testsuite/lints/non_snake_case_packages.rs +++ b/tests/testsuite/lints/non_snake_case_packages.rs @@ -25,14 +25,14 @@ non_snake_case_packages = "warn" foo.cargo("fetch -Zcargo-lints") .masquerade_as_nightly_cargo(&["cargo-lints", "test-dummy-unstable"]) .with_stderr_data(str![[r#" -[WARNING] packages should have a snake-case name +[WARNING] package `foo-bar` should have a snake-case name --> Cargo.toml:3:8 | 3 | name = "foo-bar" | ^^^^^^^^^ | = [NOTE] `cargo::non_snake_case_packages` is set to `warn` in `[lints]` -[HELP] to change the package name to snake case, convert `package.name` +[HELP] to change the package name to `foo_bar`, convert `package.name` | 3 - name = "foo-bar" 3 + name = "foo_bar" @@ -63,10 +63,10 @@ fn main() {}"#, .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 +[WARNING] package `foo-bar` should have a snake-case name --> foo-bar = [NOTE] `cargo::non_snake_case_packages` is set to `warn` in `[lints]` -[HELP] to change the package name to snake case, convert the file stem +[HELP] to change the package name to `foo_bar`, convert the file stem | 1 - [ROOT]/foo/foo-bar 1 + [ROOT]/foo/foo_bar diff --git a/tests/testsuite/lints/redundant_homepage.rs b/tests/testsuite/lints/redundant_homepage.rs index 22e19ecb199..b168f42a43c 100644 --- a/tests/testsuite/lints/redundant_homepage.rs +++ b/tests/testsuite/lints/redundant_homepage.rs @@ -27,7 +27,7 @@ redundant_homepage = "warn" p.cargo("fetch -Zcargo-lints") .masquerade_as_nightly_cargo(&["cargo-lints"]) .with_stderr_data(str![[r#" -[WARNING] `package.homepage` is redundant with another manifest field +[WARNING] `package.homepage` is redundant with `package.repository` --> Cargo.toml:7:12 | 6 | repository = "https://github.com/rust-lang/cargo/" @@ -68,7 +68,7 @@ redundant_homepage = "warn" p.cargo("fetch -Zcargo-lints") .masquerade_as_nightly_cargo(&["cargo-lints"]) .with_stderr_data(str![[r#" -[WARNING] `package.homepage` is redundant with another manifest field +[WARNING] `package.homepage` is redundant with `package.documentation` --> Cargo.toml:7:12 | 6 | documentation = "https://docs.rs/cargo/latest/cargo/" @@ -113,7 +113,7 @@ redundant_homepage = "warn" p.cargo("fetch -Zcargo-lints") .masquerade_as_nightly_cargo(&["cargo-lints"]) .with_stderr_data(str![[r#" -[WARNING] `package.homepage` is redundant with another manifest field +[WARNING] `package.homepage` is redundant with `package.documentation` --> Cargo.toml:11:1 | 10 | documentation.workspace = true diff --git a/tests/testsuite/lints/unused_dependencies.rs b/tests/testsuite/lints/unused_dependencies.rs index 0c1f2aa1598..edcf83fb7dd 100644 --- a/tests/testsuite/lints/unused_dependencies.rs +++ b/tests/testsuite/lints/unused_dependencies.rs @@ -43,14 +43,14 @@ fn unused_dep_normal() { [DOWNLOADED] unused v0.1.0 (registry `dummy-registry`) [CHECKING] unused v0.1.0 [CHECKING] foo v0.1.0 ([ROOT]/foo) -[WARNING] unused dependency +[WARNING] unused dependency `unused` --> Cargo.toml:9:13 | 9 | unused = "0.1.0" | ^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused` [WARNING] `foo` (manifest) generated 1 warning [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -102,14 +102,14 @@ fn unused_dep_build() { [DOWNLOADED] unused v0.1.0 (registry `dummy-registry`) [COMPILING] unused v0.1.0 [COMPILING] foo v0.1.0 ([ROOT]/foo) -[WARNING] unused dependency +[WARNING] unused dependency `unused` --> Cargo.toml:9:13 | 9 | unused = "0.1.0" | ^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused` [WARNING] `foo` (manifest) generated 1 warning [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -149,14 +149,14 @@ fn unused_dep_build_no_build_rs() { p.cargo("check -Zcargo-lints") .masquerade_as_nightly_cargo(&["cargo-lints"]) .with_stderr_data(str![[r#" -[WARNING] unused dependency +[WARNING] unused build dependency `unused` --> Cargo.toml:9:13 | 9 | unused = "0.1.0" | ^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused` [WARNING] `foo` (manifest) generated 1 warning [UPDATING] `dummy-registry` index [LOCKING] 1 package to latest compatible version @@ -233,14 +233,14 @@ fn unused_dep_lib_bins() { [CHECKING] lib_used v0.1.0 [CHECKING] foo v0.1.0 ([ROOT]/foo) [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s -[WARNING] unused dependency +[WARNING] unused dependency `unused` --> Cargo.toml:9:13 | 9 | unused = "0.1.0" | ^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused` [WARNING] `foo` (manifest) generated 1 warning "#]] @@ -323,14 +323,14 @@ fn unused_dep_build_with_used_dep_normal() { [DOWNLOADED] unused_build v0.1.0 (registry `dummy-registry`) [COMPILING] unused_build v0.1.0 [COMPILING] foo v0.1.0 ([ROOT]/foo) -[WARNING] unused dependency +[WARNING] unused dependency `unused_build` --> Cargo.toml:9:13 | 9 | unused_build = "0.1.0" | ^^^^^^^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused_build` [WARNING] `foo` (manifest) generated 1 warning [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -385,14 +385,14 @@ fn unused_dep_normal_but_implicit_used_dep_dev() { [DOWNLOADED] used_dev v0.1.0 (registry `dummy-registry`) [CHECKING] used_dev v0.1.0 [CHECKING] foo v0.1.0 ([ROOT]/foo) -[WARNING] unused dependency +[WARNING] unused dependency `used_dev` --> Cargo.toml:9:13 | 9 | used_dev = "0.1.0" | ^^^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `used_dev` [WARNING] `foo` (manifest) generated 1 warning [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -403,14 +403,14 @@ fn unused_dep_normal_but_implicit_used_dep_dev() { .masquerade_as_nightly_cargo(&["cargo-lints"]) .with_stderr_data(str![[r#" [CHECKING] foo v0.1.0 ([ROOT]/foo) -[WARNING] unused dependency +[WARNING] unused dependency `used_dev` --> Cargo.toml:9:13 | 9 | used_dev = "0.1.0" | ^^^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `used_dev` [HELP] to still use for development builds, move to `dev-dependencies` [WARNING] `foo` (manifest) generated 1 warning [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -469,14 +469,14 @@ fn unused_dep_normal_but_explicit_used_dep_dev() { [DOWNLOADED] used_once v0.1.0 (registry `dummy-registry`) [CHECKING] used_once v0.1.0 [CHECKING] foo v0.1.0 ([ROOT]/foo) -[WARNING] unused dependency +[WARNING] unused dependency `used_once` --> Cargo.toml:9:13 | 9 | used_once = "0.1.0" | ^^^^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `used_once` [WARNING] `foo` (manifest) generated 1 warning [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -600,14 +600,14 @@ fn optional_dependency() { [CHECKING] used v0.1.0 [CHECKING] foo v0.1.0 ([ROOT]/foo) [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s -[WARNING] unused dependency +[WARNING] unused dependency `unused` --> Cargo.toml:9:13 | 9 | unused = { version = "0.1.0", optional = true } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused` [WARNING] `foo` (manifest) generated 1 warning "#]] @@ -662,14 +662,14 @@ fn unused_dep_renamed() { [CHECKING] bar v0.1.0 [CHECKING] foo v0.1.0 ([ROOT]/foo) [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s -[WARNING] unused dependency +[WARNING] unused dependency `baz` --> Cargo.toml:9:13 | 9 | baz = { package = "bar", version = "0.1.0" } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `baz` [WARNING] `foo` (manifest) generated 1 warning "#]] @@ -717,14 +717,14 @@ fn warning_replay() { [DOWNLOADED] unused v0.1.0 (registry `dummy-registry`) [CHECKING] unused v0.1.0 [CHECKING] foo v0.1.0 ([ROOT]/foo) -[WARNING] unused dependency +[WARNING] unused dependency `unused` --> Cargo.toml:9:13 | 9 | unused = "0.1.0" | ^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused` [WARNING] `foo` (manifest) generated 1 warning [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -734,14 +734,14 @@ fn warning_replay() { p.cargo("check -Zcargo-lints") .masquerade_as_nightly_cargo(&["cargo-lints"]) .with_stderr_data(str![[r#" -[WARNING] unused dependency +[WARNING] unused dependency `unused` --> Cargo.toml:9:13 | 9 | unused = "0.1.0" | ^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused` [WARNING] `foo` (manifest) generated 1 warning [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -798,14 +798,14 @@ fn unused_dep_target() { [CHECKING] used v0.1.0 [CHECKING] foo v0.1.0 ([ROOT]/foo) [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s -[WARNING] unused dependency +[WARNING] unused dependency `unused` --> Cargo.toml:9:13 | 9 | unused = "0.1.0" | ^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused` [WARNING] `foo` (manifest) generated 1 warning "#]] @@ -1086,36 +1086,36 @@ fn package_selection() { [CHECKING] bar v0.1.0 ([ROOT]/foo/bar) [CHECKING] external v0.1.0 ([ROOT]/foo/external) [CHECKING] foo v0.1.0 ([ROOT]/foo/foo) -[WARNING] unused dependency +[WARNING] unused dependency `unused_bar` --> bar/Cargo.toml:9:13 | 9 | unused_bar = "0.1.0" | ^^^^^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused_bar` | | -[WARNING] unused dependency +[WARNING] unused dependency `bar` --> foo/Cargo.toml:11:13 | 11 | bar.path = "../bar" | ^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `bar` | | -[WARNING] unused dependency +[WARNING] unused dependency `external` --> foo/Cargo.toml:12:13 12 | external.path = "../external" | ^^^^^^^^ -[HELP] consider removing the unused dependency -[WARNING] unused dependency +[HELP] consider removing the dependency on `external` +[WARNING] unused dependency `unused_foo` --> foo/Cargo.toml:9:13 9 | unused_foo = "0.1.0" | ^^^^^^^^^^^^^^^^^^^^ -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused_foo` [WARNING] `bar` (manifest) generated 1 warning [WARNING] `foo` (manifest) generated 3 warnings [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -1129,28 +1129,28 @@ fn package_selection() { .masquerade_as_nightly_cargo(&["cargo-lints"]) .with_stderr_data( str![[r#" -[WARNING] unused dependency +[WARNING] unused dependency `bar` --> foo/Cargo.toml:11:13 | 11 | bar.path = "../bar" | ^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `bar` | | -[WARNING] unused dependency +[WARNING] unused dependency `external` --> foo/Cargo.toml:12:13 12 | external.path = "../external" | ^^^^^^^^ -[HELP] consider removing the unused dependency -[WARNING] unused dependency +[HELP] consider removing the dependency on `external` +[WARNING] unused dependency `unused_foo` --> foo/Cargo.toml:9:13 | 9 | unused_foo = "0.1.0" | ^^^^^^^^^^^^^^^^^^^^ | -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused_foo` [WARNING] `foo` (manifest) generated 3 warnings [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -1163,14 +1163,14 @@ fn package_selection() { .masquerade_as_nightly_cargo(&["cargo-lints"]) .with_stderr_data( str![[r#" -[WARNING] unused dependency +[WARNING] unused dependency `unused_bar` --> bar/Cargo.toml:9:13 | 9 | unused_bar = "0.1.0" | ^^^^^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused_bar` [WARNING] `bar` (manifest) generated 1 warning [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -1357,14 +1357,14 @@ fn allow_rustflags() { [DOWNLOADED] unused v0.1.0 (registry `dummy-registry`) [CHECKING] unused v0.1.0 [CHECKING] foo v0.1.0 ([ROOT]/foo) -[WARNING] unused dependency +[WARNING] unused dependency `unused` --> Cargo.toml:9:13 | 9 | unused = "0.1.0" | ^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused` [WARNING] `foo` (manifest) generated 1 warning [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -1412,14 +1412,14 @@ fn allow_attribute() { [DOWNLOADED] unused v0.1.0 (registry `dummy-registry`) [CHECKING] unused v0.1.0 [CHECKING] foo v0.1.0 ([ROOT]/foo) -[WARNING] unused dependency +[WARNING] unused dependency `unused` --> Cargo.toml:9:13 | 9 | unused = "0.1.0" | ^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused` [WARNING] `foo` (manifest) generated 1 warning [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -1466,14 +1466,14 @@ fn deny_in_manifest() { [DOWNLOADED] unused v0.1.0 (registry `dummy-registry`) [CHECKING] unused v0.1.0 [CHECKING] foo v0.1.0 ([ROOT]/foo) -[ERROR] unused dependency +[ERROR] unused dependency `unused` --> Cargo.toml:9:13 | 9 | unused = "0.1.0" | ^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `deny` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused` [ERROR] could not finalize `foo` (manifest) due to 1 previous error "#]]) @@ -1520,14 +1520,14 @@ fn deny_rustflags() { [DOWNLOADED] unused v0.1.0 (registry `dummy-registry`) [CHECKING] unused v0.1.0 [CHECKING] foo v0.1.0 ([ROOT]/foo) -[WARNING] unused dependency +[WARNING] unused dependency `unused` --> Cargo.toml:9:13 | 9 | unused = "0.1.0" | ^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused` [WARNING] `foo` (manifest) generated 1 warning [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -1575,14 +1575,14 @@ fn deny_attribute() { [DOWNLOADED] unused v0.1.0 (registry `dummy-registry`) [CHECKING] unused v0.1.0 [CHECKING] foo v0.1.0 ([ROOT]/foo) -[WARNING] unused dependency +[WARNING] unused dependency `unused` --> Cargo.toml:9:13 | 9 | unused = "0.1.0" | ^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused` [WARNING] `foo` (manifest) generated 1 warning [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -1630,14 +1630,14 @@ fn forbid_rustflags() { [DOWNLOADED] unused v0.1.0 (registry `dummy-registry`) [CHECKING] unused v0.1.0 [CHECKING] foo v0.1.0 ([ROOT]/foo) -[WARNING] unused dependency +[WARNING] unused dependency `unused` --> Cargo.toml:9:13 | 9 | unused = "0.1.0" | ^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused` [WARNING] `foo` (manifest) generated 1 warning [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -1685,14 +1685,14 @@ fn forbid_attribute() { [DOWNLOADED] unused v0.1.0 (registry `dummy-registry`) [CHECKING] unused v0.1.0 [CHECKING] foo v0.1.0 ([ROOT]/foo) -[WARNING] unused dependency +[WARNING] unused dependency `unused` --> Cargo.toml:9:13 | 9 | unused = "0.1.0" | ^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused` [WARNING] `foo` (manifest) generated 1 warning [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s diff --git a/tests/testsuite/lints/unused_workspace_dependencies.rs b/tests/testsuite/lints/unused_workspace_dependencies.rs index 9b202b45c1c..e12e332e0db 100644 --- a/tests/testsuite/lints/unused_workspace_dependencies.rs +++ b/tests/testsuite/lints/unused_workspace_dependencies.rs @@ -79,21 +79,21 @@ workspace = true p.cargo("fetch -Zcargo-lints") .masquerade_as_nightly_cargo(&["cargo-lints"]) .with_stderr_data(str![[r#" -[WARNING] unused workspace dependency +[WARNING] unused workspace dependency `not-inherited` --> Cargo.toml:12:1 | 12 | not-inherited = "1" | ^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_workspace_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused workspace dependency -[WARNING] unused workspace dependency +[HELP] consider removing the workspace dependency `not-inherited` +[WARNING] unused workspace dependency `unused` --> Cargo.toml:11:1 | 11 | unused = "1" | ^^^^^^ | -[HELP] consider removing the unused workspace dependency +[HELP] consider removing the workspace dependency `unused` [WARNING] workspace (manifest) generated 2 warnings [UPDATING] `dummy-registry` index [LOCKING] 6 packages to latest compatible versions diff --git a/tests/testsuite/lints/unused_workspace_package_fields.rs b/tests/testsuite/lints/unused_workspace_package_fields.rs index ab4f3832173..f51083758ad 100644 --- a/tests/testsuite/lints/unused_workspace_package_fields.rs +++ b/tests/testsuite/lints/unused_workspace_package_fields.rs @@ -51,21 +51,21 @@ workspace = true p.cargo("fetch -Zcargo-lints") .masquerade_as_nightly_cargo(&["cargo-lints"]) .with_stderr_data(str![[r#" -[WARNING] unused field in `workspace.package` +[WARNING] unused field `rust-version` in `workspace.package` --> Cargo.toml:8:1 | 8 | rust-version = "1.0" | ^^^^^^^^^^^^ | = [NOTE] `cargo::unused_workspace_package_fields` is set to `warn` in `[lints]` -[HELP] consider removing the unused field -[WARNING] unused field in `workspace.package` +[HELP] consider removing the field `workspace.package.rust-version` +[WARNING] unused field `unknown` in `workspace.package` --> Cargo.toml:9:1 | 9 | unknown = "foo" | ^^^^^^^ | -[HELP] consider removing the unused field +[HELP] consider removing the field `workspace.package.unknown` [WARNING] workspace (manifest) generated 2 warnings [WARNING] Cargo.toml: unused manifest key: workspace.package.unknown [WARNING] `foo` (manifest) generated 1 warning diff --git a/tests/testsuite/warning_override.rs b/tests/testsuite/warning_override.rs index 79d0d613d58..e9cc6953c82 100644 --- a/tests/testsuite/warning_override.rs +++ b/tests/testsuite/warning_override.rs @@ -258,7 +258,7 @@ fn lint_parse_pass() { p.cargo("fetch -Zcargo-lints") .masquerade_as_nightly_cargo(&["cargo-lints"]) .with_stderr_data(str![[r#" -[WARNING] `package.homepage` is redundant with another manifest field +[WARNING] `package.homepage` is redundant with `package.repository` --> Cargo.toml:8:24 | 7 | repository = "https://github.com/rust-lang/cargo/" @@ -275,7 +275,7 @@ fn lint_parse_pass() { p.cargo("check -Zcargo-lints") .masquerade_as_nightly_cargo(&["cargo-lints"]) .with_stderr_data(str![[r#" -[WARNING] `package.homepage` is redundant with another manifest field +[WARNING] `package.homepage` is redundant with `package.repository` --> Cargo.toml:8:24 | 7 | repository = "https://github.com/rust-lang/cargo/" @@ -314,7 +314,7 @@ fn lint_parse_pass() { .arg("build.warnings='deny'") .with_status(101) .with_stderr_data(str![[r#" -[WARNING] `package.homepage` is redundant with another manifest field +[WARNING] `package.homepage` is redundant with `package.repository` --> Cargo.toml:8:24 | 7 | repository = "https://github.com/rust-lang/cargo/" @@ -335,7 +335,7 @@ fn lint_parse_pass() { .arg("build.warnings='deny'") .with_status(101) .with_stderr_data(str![[r#" -[WARNING] `package.homepage` is redundant with another manifest field +[WARNING] `package.homepage` is redundant with `package.repository` --> Cargo.toml:8:24 | 7 | repository = "https://github.com/rust-lang/cargo/" @@ -393,14 +393,14 @@ fn lint_build_result_pass() { [DOWNLOADED] unused v0.1.0 (registry `dummy-registry`) [CHECKING] unused v0.1.0 [CHECKING] foo v0.1.0 ([ROOT]/foo) -[WARNING] unused dependency +[WARNING] unused dependency `unused` --> Cargo.toml:9:13 | 9 | unused = "0.1.0" | ^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused` [WARNING] `foo` (manifest) generated 1 warning [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s @@ -423,14 +423,14 @@ fn lint_build_result_pass() { .arg("build.warnings='deny'") .with_status(101) .with_stderr_data(str![[r#" -[WARNING] unused dependency +[WARNING] unused dependency `unused` --> Cargo.toml:9:13 | 9 | unused = "0.1.0" | ^^^^^^^^^^^^^^^^ | = [NOTE] `cargo::unused_dependencies` is set to `warn` in `[lints]` -[HELP] consider removing the unused dependency +[HELP] consider removing the dependency on `unused` [WARNING] `foo` (manifest) generated 1 warning [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s [ERROR] warnings are denied by `build.warnings` configuration