Fix redundant_readme lint for lower-priority README files#17208
Open
goutamadwant wants to merge 1 commit into
Open
Fix redundant_readme lint for lower-priority README files#17208goutamadwant wants to merge 1 commit into
goutamadwant wants to merge 1 commit into
Conversation
Collaborator
|
Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @epage (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
Why was this reviewer chosen?The reviewer was selected based on:
|
epage
reviewed
Jul 13, 2026
| }; | ||
|
|
||
| if !DEFAULT_README_FILES.contains(&readme.as_str()) { | ||
| if default_readme_from_package_root(pkg.root()).as_deref() != Some(readme) { |
Contributor
There was a problem hiding this comment.
Should we keep the check of DEFAULT_README_FILES as a fast path?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR try to resolve?
Closes #17206.
cargo::redundant_readmewarned wheneverpackage.readmematched any default README filename. That can be wrong when a higher-priority default README file also exists. For example, removingreadme = "README.txt"whileREADME.mdis present would make Cargo inferREADME.md, changing the package metadata.This changes the lint to compare the explicit readme value with the same package-root README inference helper used by manifest normalization, so the lint only fires when removing the field preserves the inferred README.
How to test and review this PR?
Added coverage for both sides of the inference behavior:
README.txtwithREADME.mdalso present should not warn.README.txtas the inferred default should still warn.Commands run:
cargo fmt --checkcargo test -p cargo --test testsuite -- lints::redundant_readmecargo test -p cargo --test testsuite -- lints::