-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add more docs for msrvs.rs #16030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add more docs for msrvs.rs #16030
Conversation
There was a problem hiding this 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.
| /// 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) { |
There was a problem hiding this comment.
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.
| /// 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 |
There was a problem hiding this comment.
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."
| /// 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. |
There was a problem hiding this comment.
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.
| /// 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 |
There was a problem hiding this comment.
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.
changelog: Add more docs for msrvs.rs in clippy_utils