-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix unused imports for android #6106
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
Conversation
WalkthroughGates Android-specific imports and the getpwall function in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
✨ Finishing Touches
🧪 Generate 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
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.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
vm/src/stdlib/pwd.rs (1)
106-110
: Replace non-existentstr::ptr::NonNull
withstd::ptr::NonNull
The code on line 106 currently references
str::ptr::NonNull
, which does not exist and will fail to compile on non-Android targets. It must be changed tostd::ptr::NonNull
. Optionally, you can specify the pointee type (<libc::passwd>
) to satisfy Clippy in some toolchains.• File:
vm/src/stdlib/pwd.rs
– Line 106Proposed minimal fix:
- while let Some(ptr) = str::ptr::NonNull::new(unsafe { libc::getpwent() }) { + while let Some(ptr) = std::ptr::NonNull::new(unsafe { libc::getpwent() }) {Optional clarity for Clippy:
- while let Some(ptr) = std::ptr::NonNull::new(unsafe { libc::getpwent() }) { + while let Some(ptr) = std::ptr::NonNull::<libc::passwd>::new(unsafe { libc::getpwent() }) {
🧹 Nitpick comments (1)
vm/src/stdlib/pwd.rs (1)
97-114
: API decision: consider a stub for Android to preserve parityCurrently
getpwall
is unavailable on Android. That’s acceptable; however, consider exporting a stub on Android that raises a PythonNotImplementedError
to keep the module’s API surface consistent across platforms. This can help avoid runtime attribute checks in callers.If you want, I can draft a minimal Android-only stub that compiles without reintroducing unused-import warnings.
📜 Review details
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
vm/src/stdlib/pwd.rs
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.rs
: Follow the default rustfmt code style (cargo fmt
to format)
Always run clippy to lint code (cargo clippy
) before completing tasks. Fix any warnings or lints that are introduced by your changes
Follow Rust best practices for error handling and memory management
Use the macro system (pyclass
,pymodule
,pyfunction
, etc.) when implementing Python functionality in Rust
Files:
vm/src/stdlib/pwd.rs
🔇 Additional comments (2)
vm/src/stdlib/pwd.rs (2)
7-13
: Imports reshuffle looks good
IntoPyException
is used ingetpwuid
, and the other items are required elsewhere in the file. No new lints introduced here.
16-17
: Good use of cfg to eliminate Android-only unused importsGating
PyObjectRef
andToPyObject
behind#[cfg(not(target_os = "android"))]
aligns with the goal of silencing Android warnings. These are only needed bygetpwall
, which is also non-Android.
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.
👍
follow up on #6083
Summary by CodeRabbit
New Features
Bug Fixes
Chores