Add undocumented_as_casts lint#16682
Conversation
|
rustbot has assigned @samueltardieu. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Lintcheck changes for d3a2c82
This comment will be updated if you push new changes |
| } | ||
| } | ||
|
|
||
| /// Checks if there is a `// CAST:` or `/* CAST:` comment preceding the cast expression. |
There was a problem hiding this comment.
Wouldn't it be better to share the logic with the "SAFETY" logic? It looks like a lot of duplicated functionalities.
|
Reminder, once the PR becomes ready for a review, use |
|
This lint has been nominated for inclusion. |
|
Hi, @samueltardieu @rustbot ready |
This comment has been minimized.
This comment has been minimized.
…dd test case for declared macro
- Added new configuration options: `check-undocumented-as-any-cast`, `check-undocumented-as-const-ptr-cast`, and `check-undocumented-as-mut-ptr-cast` to enforce documentation comments for `as` casts. - Updated the linting logic to check for `// CAST:` comments for `as` casts, including specific checks for mutable and constant pointer casts. - Enhanced documentation in the lint configuration and changelog to reflect the new checks. - Created comprehensive tests to validate the behavior of the new lint checks, including scenarios with and without comments. - Removed outdated test files related to the previous undocumented casts implementation.
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
To allow the existing projects to gradually adopt this lint, I have added configurations to enable checks for specific scenarios that users may be most concerned about. |
|
☔ The latest upstream changes (possibly #16850) made this pull request unmergeable. Please resolve the merge conflicts. |
Checks for
ascasts that do not have a preceding// CAST:comment.fixes #15963
changelog: new lint: [
undocumented_as_casts]