◐ Shell
clean mode source ↗

finish no_std clippy by youknowone · Pull Request #6587 · RustPython/RustPython

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR systematically replaces standard library (std::) import paths with their core:: and alloc:: equivalents across 15+ files. Changes include shifting memory utilities, pointer operations, synchronization primitives, and type constructors to achieve no-std/alloc compatibility throughout multiple crates.

Changes

Cohort / File(s) Summary
Memory and utility operations
crates/common/src/os.rs, crates/stdlib/src/sqlite.rs, crates/vm/src/function/builtin.rs
std::mem, std::str replaced with core::mem, core::str equivalents for UTF-8 decoding, size computation, and slice creation
Pointer and slice operations
crates/stdlib/src/socket.rs, crates/vm/src/stdlib/ctypes/simple.rs, crates/vm/src/stdlib/os.rs, crates/vm/src/stdlib/posix.rs
std::ptr and std::slicecore::ptr and core::slice for pointer arithmetic, null construction, and raw slice creation
Type system and operators
crates/jit/tests/common.rs, crates/sre_engine/benches/benches.rs
std::ops::{ControlFlow, Range} replaced with core::ops::* equivalents
FFI and string types
crates/stdlib/src/scproxy.rs, crates/stdlib/src/socket.rs, crates/vm/src/stdlib/ctypes.rs
std::borrow::Cowalloc::borrow::Cow and std::ffi::CStringalloc::ffi::CString
Array and container internals
crates/vm/src/stdlib/ctypes/array.rs
Imports shifted to alloc::borrow::Cow and core::slice::from_raw_parts_mut
Atomic synchronization
crates/vm/src/stdlib/thread.rs
All std::sync::atomic::* replaced with core::sync::atomic::* in RLock implementation, including AtomicUsize and Ordering variants
WebAssembly/WASM bindings
crates/wasm/src/{browser_module,js_module,lib,vm_class}.rs
std::{cell, rc, fmt, future} replaced with core::* and alloc::rc::* equivalents; added extern crate alloc at crate root

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • #6564: Modifies crates/stdlib/src/socket.rs with overlapping changes to getaddrinfo and address encoding logic, both affecting the same file's memory/alloc pathways.

Suggested reviewers

  • arihant2math

Poem

🐰 The rabbit hops through code so neat,

Swapping std for core so sweet,

No_std paths now align,

Alloc imports, memories align,

One hop closer to no-std's goal! ✨

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e1fc93 and cf46d5f.

📒 Files selected for processing (17)
  • crates/common/src/os.rs
  • crates/jit/tests/common.rs
  • crates/sre_engine/benches/benches.rs
  • crates/stdlib/src/scproxy.rs
  • crates/stdlib/src/socket.rs
  • crates/stdlib/src/sqlite.rs
  • crates/vm/src/function/builtin.rs
  • crates/vm/src/stdlib/ctypes.rs
  • crates/vm/src/stdlib/ctypes/array.rs
  • crates/vm/src/stdlib/ctypes/simple.rs
  • crates/vm/src/stdlib/os.rs
  • crates/vm/src/stdlib/posix.rs
  • crates/vm/src/stdlib/thread.rs
  • crates/wasm/src/browser_module.rs
  • crates/wasm/src/js_module.rs
  • crates/wasm/src/lib.rs
  • crates/wasm/src/vm_class.rs

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.