GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — clippy `significant_drop_in_scrutinee` & `explicit_deref_methods` by ShaharNaveh · Pull Request #8104 · RustPython/RustPython Conversation
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (13)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (7)
📝 WalkthroughWalkthroughTwo new Clippy workspace lint rules ( ChangesClippy Lint Enablement and Codebase-Wide Fixes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
390038e to
e139075
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
crates/common/src/format.rs (1)
900-903: ⚡ Quick winThe
explicit_deref_methodscleanup is incomplete.These remaining
.deref()call sites will keep the new workspace lint firing.
crates/common/src/format.rs#L900-L903: replaces.deref()with autoderef (s.chars(),s.to_owned()).crates/vm/src/builtins/type.rs#L338-L344: replaceself.init.deref()/self.getitem.deref()with borrowed autoderef.crates/vm/src/builtins/type.rs#L1431-L1438: replaceself.name().deref()with&self.name().🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/common/src/format.rs` around lines 900 - 903, Remove the explicit deref() calls to allow Rust's autoderef mechanism to handle the dereferencing automatically. In crates/common/src/format.rs lines 900-903, replace s.deref().chars() with s.chars() and s.deref().to_owned() with s.to_owned(). In crates/vm/src/builtins/type.rs lines 338-344, replace self.init.deref() and self.getitem.deref() with borrowed references using the autoderef operator (e.g., &self.init and &self.getitem). In crates/vm/src/builtins/type.rs lines 1431-1438, replace self.name().deref() with &self.name() to let autoderef handle the dereferencing. These changes will resolve the explicit_deref_methods lint warnings across all three affected sites.Source: Coding guidelines
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/vm/src/object/core.rs`:
- Around line 2133-2135: Replace explicit `.deref()` and `.deref_mut()` calls
with direct deref operator syntax across multiple files to resolve clippy's
explicit_deref_methods warnings. In crates/vm/src/object/core.rs at lines
2123-2125 (first Hash impl), replace `self.deref().hash(state)` with
`(*self).hash(state)`. At lines 2133-2135 (first PartialEq impl), replace
`self.deref().eq(&**other)` with `(*self).eq(&*other)`. At lines 2399-2402
(second Hash impl), apply the same Hash pattern replacement. At lines 2410-2412
(second PartialEq impl), apply the same PartialEq pattern replacement. In
crates/vm/src/builtins/list.rs at lines 239-240 in the clear() method, replace
`self.borrow_vec_mut().deref_mut()` with `&mut *self.borrow_vec_mut()`. At lines
479-480 in the init() method, replace `zelf.borrow_vec_mut().deref_mut()` with
`&mut *zelf.borrow_vec_mut()`. After applying all changes, run cargo clippy to
verify no remaining lint warnings.
---
Nitpick comments:
In `@crates/common/src/format.rs`:
- Around line 900-903: Remove the explicit deref() calls to allow Rust's
autoderef mechanism to handle the dereferencing automatically. In
crates/common/src/format.rs lines 900-903, replace s.deref().chars() with
s.chars() and s.deref().to_owned() with s.to_owned(). In
crates/vm/src/builtins/type.rs lines 338-344, replace self.init.deref() and
self.getitem.deref() with borrowed references using the autoderef operator
(e.g., &self.init and &self.getitem). In crates/vm/src/builtins/type.rs lines
1431-1438, replace self.name().deref() with &self.name() to let autoderef handle
the dereferencing. These changes will resolve the explicit_deref_methods lint
warnings across all three affected sites.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 6e31d954-9ca8-402c-b36c-34450729bb75
Cargo.tomlcrates/common/src/borrow.rscrates/common/src/format.rscrates/stdlib/src/_asyncio.rscrates/stdlib/src/array.rscrates/stdlib/src/ssl.rscrates/vm/src/builtins/classmethod.rscrates/vm/src/builtins/list.rscrates/vm/src/builtins/property.rscrates/vm/src/builtins/set.rscrates/vm/src/builtins/staticmethod.rscrates/vm/src/builtins/type.rscrates/vm/src/datastack.rscrates/vm/src/exceptions.rscrates/vm/src/intern.rscrates/vm/src/object/core.rscrates/vm/src/scope.rscrates/vm/src/stdlib/_ctypes/base.rscrates/vm/src/stdlib/_ctypes/pointer.rscrates/vm/src/stdlib/_thread.rscrates/vm/src/types/slot.rs
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| fn eq(&self, other: &Self) -> bool { | ||
| self.deref().eq(other.deref()) | ||
| self.deref().eq(&**other) | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🏁 Script executed:
#!/bin/bash rg -n '\.deref(_mut)?\(' crates/vm/src/builtins/list.rs crates/vm/src/object/core.rs
Repository: RustPython/RustPython
Length of output: 555
🏁 Script executed:
#!/bin/bash # Check context for core.rs deref calls echo "=== crates/vm/src/object/core.rs context ===" sed -n '2120,2140p' crates/vm/src/object/core.rs | cat -n echo sed -n '2395,2415p' crates/vm/src/object/core.rs | cat -n echo # Check context for list.rs deref_mut calls echo "=== crates/vm/src/builtins/list.rs context ===" sed -n '235,245p' crates/vm/src/builtins/list.rs | cat -n echo sed -n '475,485p' crates/vm/src/builtins/list.rs | cat -n
Repository: RustPython/RustPython
Length of output: 1998
🏁 Script executed:
#!/bin/bash # Verify exact line numbers for each site mentioned in review echo "=== Verifying line numbers ===" echo "core.rs Hash impl for Py:" sed -n '2123,2126p' crates/vm/src/object/core.rs | cat -n echo "core.rs Eq impl for Py:" sed -n '2132,2136p' crates/vm/src/object/core.rs | cat -n echo "core.rs Hash impl for PyRef:" sed -n '2399,2403p' crates/vm/src/object/core.rs | cat -n echo "core.rs Eq impl for PyRef:" sed -n '2409,2413p' crates/vm/src/object/core.rs | cat -n echo "list.rs clear method:" sed -n '238,241p' crates/vm/src/builtins/list.rs | cat -n echo "list.rs init method:" sed -n '478,481p' crates/vm/src/builtins/list.rs | cat -n
Repository: RustPython/RustPython
Length of output: 1081
🏁 Script executed:
#!/bin/bash # Final check: ensure only the 6 sites remain echo "Total explicit deref calls in both files:" rg -c '\.deref(_mut)?\(' crates/vm/src/builtins/list.rs crates/vm/src/object/core.rs | sort echo echo "All lines with explicit deref (should be exactly 6):" rg -n '\.deref(_mut)?\(' crates/vm/src/builtins/list.rs crates/vm/src/object/core.rs | wc -l
Repository: RustPython/RustPython
Length of output: 227
Replace explicit .deref() and .deref_mut() calls with direct deref syntax to resolve clippy's explicit_deref_methods warnings.
crates/vm/src/object/core.rs#L2124 / L2401: Replace self.deref().hash(state) with (*self).hash(state) in Hash impls.crates/vm/src/object/core.rs#L2134 / L2411: Replace self.deref().eq(&**other) with (*self).eq(&*other) in PartialEq impls.crates/vm/src/builtins/list.rs#L240: Replace self.borrow_vec_mut().deref_mut() with &mut *self.borrow_vec_mut() in clear().crates/vm/src/builtins/list.rs#L480: Replace zelf.borrow_vec_mut().deref_mut() with &mut *zelf.borrow_vec_mut() in init().After changes, run cargo clippy to confirm no remaining lint warnings.
crates/vm/src/object/core.rs#L2133-L2135 (this comment)crates/vm/src/object/core.rs#L2410-L2412crates/vm/src/object/core.rs#L2123-L2125crates/vm/src/object/core.rs#L2399-L2402crates/vm/src/builtins/list.rs#L239-L240crates/vm/src/builtins/list.rs#L479-L480Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/vm/src/object/core.rs` around lines 2133 - 2135, Replace explicit
`.deref()` and `.deref_mut()` calls with direct deref operator syntax across
multiple files to resolve clippy's explicit_deref_methods warnings. In
crates/vm/src/object/core.rs at lines 2123-2125 (first Hash impl), replace
`self.deref().hash(state)` with `(*self).hash(state)`. At lines 2133-2135 (first
PartialEq impl), replace `self.deref().eq(&**other)` with `(*self).eq(&*other)`.
At lines 2399-2402 (second Hash impl), apply the same Hash pattern replacement.
At lines 2410-2412 (second PartialEq impl), apply the same PartialEq pattern
replacement. In crates/vm/src/builtins/list.rs at lines 239-240 in the clear()
method, replace `self.borrow_vec_mut().deref_mut()` with `&mut
*self.borrow_vec_mut()`. At lines 479-480 in the init() method, replace
`zelf.borrow_vec_mut().deref_mut()` with `&mut *zelf.borrow_vec_mut()`. After
applying all changes, run cargo clippy to verify no remaining lint warnings.
Source: Coding guidelines
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.