More clippy rules by ShaharNaveh · Pull Request #8123 · RustPython/RustPython
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: b4e6b253-b5ea-48b4-8d30-514cbc1c216b
📒 Files selected for processing (1)
crates/host_env/src/overlapped.rs
✅ Files skipped from review due to trivial changes (1)
- crates/host_env/src/overlapped.rs
📝 Walkthrough
Walkthrough
Extends the workspace Clippy pedantic lint configuration in Cargo.toml with eleven new warn-level entries and applies the resulting lint fixes across six crates: replacing if/else { 1 }/{ 0 } patterns with From<bool> conversions, substituting Ipv4Addr::LOCALHOST for the literal constructor, refactoring a comment-detection pattern, and updating doc comment formatting.
Changes
Clippy Lint Config and Fixes
| Layer / File(s) | Summary |
|---|---|
Workspace Clippy lint configuration Cargo.toml |
Adds bool_to_int_with_if, doc_link_with_quotes, ip_constant, large_futures, non_std_lazy_statics, range_minus_one, range_plus_one, single_char_pattern, unchecked_time_subtraction, unnecessary_box_returns, and unnecessary_join as warn-level pedantic lints, with reordering of the surrounding entries. |
bool_to_int_with_if fixes crates/codegen/src/compile.rs, crates/host_env/src/ctypes.rs, crates/host_env/src/overlapped.rs, crates/vm/src/builtins/range.rs, crates/vm/src/stdlib/_ctypes/base.rs |
Replaces if condition { 1 } else { 0 } patterns with u32::from(...), usize::from(...), u8::from(...), or i32::from(...) conversions in num_annotations, case_count, boolean ctypes encode/decode, PyRange::count, PyCData::_b_needsfree_, and PostQueuedCompletionStatus parameter passing. |
ip_constant, doc_link_with_quotes, and _ast fixes crates/stdlib/src/ssl.rs, crates/vm/src/stdlib/_ast.rs, crates/vm/src/warn.rs |
Replaces Ipv4Addr::new(127, 0, 0, 1) with Ipv4Addr::LOCALHOST, refactors # comment-position detection in type_ignores_from_source to if let Some form, and updates three doc comments to use inline code backticks for sys.modules['warnings'].* references. |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
- RustPython/RustPython#8050: Directly extends the same
[workspace.lints.clippy]pedantic lintwarnentries inCargo.toml.
Suggested reviewers
- youknowone
- coolreader18
Poem
🐇 Hop hop, no
ifto fuss,
bool::fromis cleaner for us!
LOCALHOSTshines bright and clear,
New lints keep the codebase dear.
✨ The rabbit says: less noise, more cheer!
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 inconclusive)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Title check | ❓ Inconclusive | The title 'More clippy rules' is vague and does not accurately reflect the primary changes, which involve applying specific Clippy lint rules across multiple files and updating Cargo.toml configuration. | Consider a more descriptive title such as 'Apply bool_to_int_with_if and other Clippy lints' or 'Refactor code to match Clippy pedantic lints configuration' to clearly communicate the main objective. |
✅ Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.