Skip to content

Conversation

@suprohub
Copy link

@suprohub suprohub commented Nov 4, 2025

changelog: Add more docs for msrvs.rs in clippy_utils

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 4, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 4, 2025

r? @Jarcho

rustbot has assigned @Jarcho.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Copy link
Contributor

@Jarcho Jarcho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also make sure to end all sentences in documentation with appropriate punctuation.

View changes since this review

Comment on lines +135 to 149
/// Reads the MSRV from Cargo.toml and merges it with the existing configuration
///
/// This method checks the `CARGO_PACKAGE_RUST_VERSION` environment variable set by Cargo
/// and integrates it with the MSRV from `clippy.toml` according to these rules:
///
/// - If only Cargo.toml specifies an MSRV, it will be used
/// - If both Cargo.toml and clippy.toml specify an MSRV and they differ, a warning is emitted
/// and the value from `clippy.toml` takes precedence
/// - If neither specifies an MSRV, no change occurs
///
/// # Note
///
/// This should be called during lint pass initialization to ensure the MSRV from Cargo.toml
/// is properly considered alongside the clippy.toml configuration
pub fn read_cargo(&mut self, sess: &Session) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is overly verbose and the function won't exist here after the config rewrite PR is merged.

Comment on lines +191 to +194
/// Checks if the current MSRV meets or exceeds the required version
///
/// Returns `true` if no MSRV is configured or if the current MSRV is greater than
/// or equal to the required version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be shortened to just "Checks if the current MSRV is either None, or is at least as high as the required version."

Comment on lines +199 to +202
/// Processes attributes to update the MSRV stack when entering a new scope
///
/// If a `#[clippy::msrv]` attribute is found, parses the version and pushes it
/// onto the stack. Also marks that MSRV attributes have been seen globally.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be shortened to just "If the attributes contain a version attribute, pushes that version onto the stack."

A second paragraph about this being intended to be used from a lint pass's check_attributes function is also worth having.

Comment on lines +210 to +213
/// Processes attributes to update the MSRV stack when leaving a scope
///
/// If a `#[clippy::msrv]` attribute is found, pops the most recently pushed
/// MSRV from the stack, effectively restoring the previous MSRV level
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be shortened to just "If the attributes contain a version attribute, pops a version from the stack."

A second paragraph about this being intended to be used from a lint pass's check_attributes_post function is also worth having.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants