-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix mkdir error args #6114
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
Fix mkdir error args #6114
Conversation
WalkthroughIntroduces a dedicated C-string Changes
Sequence Diagram(s)No sequence diagram — changes are internal to error construction and syscall argument handling. Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
📜 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). (11)
✨ 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
🧹 Nitpick comments (3)
vm/src/stdlib/os.rs (3)
298-300
: Renamepath_str
(it’s not a string) and clarify intent.The variable holds an OsPath clone, not a string. Renaming helps avoid confusion and keeps clippy happy.
- let path_str = path.clone(); // Clone for error reporting + let path_for_err = path.clone(); // Keep an OsPath clone for error reporting
303-309
: Avoid let-and-return; return directly with filename-aware error.Functionally correct, but the temporary
res
plusreturn res;
is unnecessary. Returning the result of theif
expression directly improves readability. Also, update the renamed variable.- let res = if res < 0 { - let err = crate::common::os::last_os_error(); - Err(IOErrorBuilder::with_filename(&err, path_str, vm)) - } else { - Ok(()) - }; - return res; + return if res < 0 { + let err = crate::common::os::last_os_error(); + Err(IOErrorBuilder::with_filename(&err, path_for_err, vm)) + } else { + Ok(()) + };
314-319
: Mirror the same direct-return style in the non-dir_fd
/Redox path.Same nit as above; eliminate the temporary and return immediately. Update the variable name consistently.
- if res < 0 { - let err = crate::common::os::last_os_error(); - Err(IOErrorBuilder::with_filename(&err, path_str, vm)) - } else { - Ok(()) - } + if res < 0 { + let err = crate::common::os::last_os_error(); + return Err(IOErrorBuilder::with_filename(&err, path_for_err, vm)); + } + Ok(())
📜 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/os.rs
(1 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/os.rs
🧬 Code graph analysis (1)
vm/src/stdlib/os.rs (3)
common/src/os.rs (2)
last_os_error
(23-34)last_os_error
(40-42)vm/src/ospath.rs (1)
with_filename
(156-167)vm/src/stdlib/nt.rs (1)
mkdir
(456-471)
⏰ 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). (11)
- GitHub Check: Run tests under miri
- GitHub Check: Run snippets and cpython tests (windows-latest)
- GitHub Check: Run snippets and cpython tests (macos-latest)
- GitHub Check: Run snippets and cpython tests (ubuntu-latest)
- GitHub Check: Check Rust code with rustfmt and clippy
- GitHub Check: Check the WASM package and demo
- GitHub Check: Run rust tests (ubuntu-latest)
- GitHub Check: Run rust tests (windows-latest)
- GitHub Check: Run rust tests (macos-latest)
- GitHub Check: Ensure compilation on various targets
- GitHub Check: Run snippets and cpython tests on wasm-wasi
Summary by CodeRabbit
Bug Fixes
Chores