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
76 changes: 38 additions & 38 deletions doc/book/src/reference/lints.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ These lints are all set to the 'allow' level by default.

These lints are all set to the 'warn' level by default.
- [`blanket_hint_mostly_unused`](#blanket_hint_mostly_unused)
- [`manual_readme`](#manual_readme)
- [`missing_lints_inheritance`](#missing_lints_inheritance)
- [`non_kebab_case_bins`](#non_kebab_case_bins)
- [`redundant_homepage`](#redundant_homepage)
- [`redundant_readme`](#redundant_readme)
- [`unknown_lints`](#unknown_lints)
- [`unused_dependencies`](#unused_dependencies)
- [`unused_workspace_dependencies`](#unused_workspace_dependencies)
Expand Down Expand Up @@ -85,6 +85,43 @@ hint-mostly-unused = true
```


## `manual_readme`

- Group: `style`
- Level: `warn`
- Minimal [`package.rust-version`]: `1.79.0`


### What it does

Checks for `package.readme` fields that can be inferred.

See also [`package.readme` reference documentation](manifest.md#the-readme-field).

### Why is this bad?

Adds boilerplate.

### Drawbacks

It might not be obvious if they named their file correctly.

### Example

```toml
[package]
name = "foo"
readme = "README.md"
```

Should be written as:

```toml
[package]
name = "foo"
```


## `missing_lints_inheritance`

- Group: `suspicious`
Expand Down Expand Up @@ -333,43 +370,6 @@ repository = "https://github.com/rust-lang/cargo/"
```


## `redundant_readme`

- Group: `style`
- Level: `warn`
- Minimal [`package.rust-version`]: `1.79.0`


### What it does

Checks for `package.readme` fields that can be inferred.

See also [`package.readme` reference documentation](manifest.md#the-readme-field).

### Why is this bad?

Adds boilerplate.

### Drawbacks

It might not be obvious if they named their file correctly.

### Example

```toml
[package]
name = "foo"
readme = "README.md"
```

Should be written as:

```toml
[package]
name = "foo"
```


## `text_direction_codepoint_in_comment`

- Group: `correctness`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate::workspace::Workspace;
use crate::workspace::parser::DEFAULT_README_FILES;

pub static LINT: &Lint = &Lint {
name: "redundant_readme",
name: "manual_readme",
desc: "explicit `package.readme` can be inferred",
primary_group: &STYLE,
msrv: Some(super::CARGO_LINTS_MSRV),
Expand Down
12 changes: 6 additions & 6 deletions src/diagnostics/rules/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
mod blanket_hint_mostly_unused;
mod deferred_parse_diagnostics;
mod im_a_teapot;
mod manual_readme;
mod missing_lints_features;
mod missing_lints_inheritance;
mod non_kebab_case_bins;
Expand All @@ -9,7 +10,6 @@ mod non_kebab_case_packages;
mod non_snake_case_features;
mod non_snake_case_packages;
mod redundant_homepage;
mod redundant_readme;
mod text_direction_codepoint_in_comment;
mod text_direction_codepoint_in_literal;
mod unknown_lints;
Expand Down Expand Up @@ -54,6 +54,10 @@ pub const PARSE_PASS_RULES: &[ParsePassRule<'static>] = &[
lint: unused_workspace_package_fields::LINT,
},
// `warn`
ParsePassRule::LintPackage {
rule: manual_readme::lint_package,
lint: manual_readme::LINT,
},
ParsePassRule::LintPackage {
rule: missing_lints_inheritance::lint_package,
lint: missing_lints_inheritance::LINT,
Expand All @@ -66,10 +70,6 @@ pub const PARSE_PASS_RULES: &[ParsePassRule<'static>] = &[
rule: redundant_homepage::lint_package,
lint: redundant_homepage::LINT,
},
ParsePassRule::LintPackage {
rule: redundant_readme::lint_package,
lint: redundant_readme::LINT,
},
ParsePassRule::LintPackage {
rule: unused_dependencies::lint_package,
lint: unused_dependencies::LINT,
Expand Down Expand Up @@ -100,14 +100,14 @@ pub const PARSE_PASS_RULES: &[ParsePassRule<'static>] = &[
pub static LINTS: &[&crate::diagnostics::Lint] = &[
blanket_hint_mostly_unused::LINT,
im_a_teapot::LINT,
manual_readme::LINT,
missing_lints_inheritance::LINT,
non_kebab_case_bins::LINT,
non_kebab_case_features::LINT,
non_kebab_case_packages::LINT,
non_snake_case_features::LINT,
non_snake_case_packages::LINT,
redundant_homepage::LINT,
redundant_readme::LINT,
text_direction_codepoint_in_comment::LINT,
text_direction_codepoint_in_literal::LINT,
unknown_lints::LINT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ readme = "README.md"

[lints.cargo]
default = { level = "allow", priority = -1 }
redundant_readme = "warn"
manual_readme = "warn"
"#,
)
.file("src/main.rs", "fn main() {}")
Expand All @@ -33,7 +33,7 @@ redundant_readme = "warn"
7 | readme = "README.md"
| ^^^^^^^^^^^^^^^^^^^^
|
= [NOTE] `cargo::redundant_readme` is set to `warn` in `[lints]`
= [NOTE] `cargo::manual_readme` is set to `warn` in `[lints]`
[HELP] consider removing `package.readme`
[WARNING] `foo` (manifest) generated 1 warning

Expand All @@ -55,7 +55,7 @@ authors = []

[lints.cargo]
default = { level = "allow", priority = -1 }
redundant_readme = "warn"
manual_readme = "warn"
"#,
)
.file("src/main.rs", "fn main() {}")
Expand Down Expand Up @@ -83,7 +83,7 @@ readme = "FOO.md"

[lints.cargo]
default = { level = "allow", priority = -1 }
redundant_readme = "warn"
manual_readme = "warn"
"#,
)
.file("src/main.rs", "fn main() {}")
Expand Down Expand Up @@ -111,7 +111,7 @@ readme = "src/README.md"

[lints.cargo]
default = { level = "allow", priority = -1 }
redundant_readme = "warn"
manual_readme = "warn"
"#,
)
.file("src/main.rs", "fn main() {}")
Expand Down Expand Up @@ -142,7 +142,7 @@ readme.workspace = true

[lints.cargo]
default = { level = "allow", priority = -1 }
redundant_readme = "warn"
manual_readme = "warn"
"#,
)
.file("src/main.rs", "fn main() {}")
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/lints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ use cargo_test_support::str;
mod blanket_hint_mostly_unused;
mod error;
mod inherited;
mod manual_readme;
mod missing_lints_inheritance;
mod non_kebab_case_bins;
mod non_kebab_case_features;
mod non_kebab_case_packages;
mod non_snake_case_features;
mod non_snake_case_packages;
mod redundant_homepage;
mod redundant_readme;
mod text_direction_codepoint;
mod unknown_lints;
mod unused_dependencies;
Expand Down