{"id":"1a153f1230c7cb09","repo":"rust-lang/cargo","slug":"lints-tool-name-is-not-valid-lint-name-try","errorCode":null,"errorMessage":"`lints.{tool}.{name}` is not valid lint name; try `lints.{prefix}.{suffix}`","messagePattern":"`lints\\.(.+?)\\.(.+?)` is not valid lint name; try `lints\\.(.+?)\\.(.+?)`","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/workspace/parser/mod.rs","lineNumber":2727,"sourceCode":"        for (name, config) in lints {\n            let normalized = name.replace('-', \"_\");\n            if name.contains('-') {\n                warnings.push(format!(\n                    \"`lints.{tool}.{name}` is deprecated in favor of \\\n                     `lints.{tool}.{normalized}` and will not work in a \\\n                     future edition\"\n                ));\n            }\n            if let Some(existing) = seen_normalized.get(&normalized) {\n                warnings.push(format!(\n                    \"duplicate lint `{existing}` in `[lints.{tool}]`, \\\n                     conflicts with `{name}` and will not work in a future edition\"\n                ));\n            }\n            seen_normalized.insert(normalized.clone(), name.to_string());\n            if let Some((prefix, suffix)) = name.split_once(\"::\") {\n                if tool == prefix {\n                    anyhow::bail!(\n                        \"`lints.{tool}.{name}` is not valid lint name; try `lints.{prefix}.{suffix}`\"\n                    )\n                } else if tool == \"rust\" && supported.contains(&prefix) {\n                    anyhow::bail!(\n                        \"`lints.{tool}.{name}` is not valid lint name; try `lints.{prefix}.{suffix}`\"\n                    )\n                } else {\n                    anyhow::bail!(\"`lints.{tool}.{name}` is not a valid lint name\")\n                }\n            } else if let Some(config) = config.config() {\n                for config_name in config.keys() {\n                    // manually report unused manifest key warning since we collect all the \"extra\"\n                    // keys and values inside the config table\n                    let expected = EXPECTED_LINT_CONFIG.contains(&(tool, name, config_name));\n                    if !expected {\n                        let message =\n                            format!(\"unused manifest key: `lints.{tool}.{name}.{config_name}`\");\n                        warnings.push(message);","sourceCodeStart":2709,"sourceCodeEnd":2745,"githubUrl":"https://github.com/rust-lang/cargo/blob/0e07a155371a6ce88ae53a2c00df940280c09a67/src/workspace/parser/mod.rs#L2709-L2745","documentation":"Thrown during lint-table validation at src/workspace/parser/mod.rs:2727. If a lint name contains `::` and its first segment equals the tool name (e.g. `[lints.rust] rust::foo = ...` → prefix \"rust\" == tool \"rust\"), cargo treats it as a redundant/misplaced qualifier and suggests dropping the prefix by rewriting it as `lints.{prefix}.{suffix}` (i.e. `lints.rust.foo`).","triggerScenarios":"Writing `[lints.rust] rust::doc_markdown = \"warn\"` or `[lints.cargo] cargo::... ` — the lint key redundantly repeats the tool as a `::` prefix.","commonSituations":"Copy-pasting the fully-qualified rustc lint name (`rust::xxx`) directly into the `[lints.rust]` table; tooling that emits group-qualified names.","solutions":["Remove the redundant `tool::` prefix: under `[lints.rust]` write `foo = \"warn\"` instead of `rust::foo = \"warn\"`.","Use the bare lint name that matches the table's tool."],"exampleFix":"# before\n[lints.rust]\nrust::doc_markdown = \"warn\"\n# after\n[lints.rust]\ndoc_markdown = \"warn\"","handlingStrategy":"validation","validationCode":"for (name, _) in lints_for_tool {\n    if let Some((prefix, _suffix)) = name.split_once(\"::\") {\n        if prefix == tool {\n            return Err(format!(\"lint {name} redundantly repeats tool {tool}\"));\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Don't repeat the tool as a `::` prefix inside its own `[lints.<tool>]` table.","Use bare lint names that match the table's tool."],"tags":["manifest","lints","naming"],"analyzedSha":"0e07a155371a6ce88ae53a2c00df940280c09a67","analyzedAt":"2026-08-06T01:46:58.334Z","schemaVersion":2}