Skip to content

finish no_std clippy#6587

Merged
youknowone merged 1 commit intoRustPython:mainfrom
youknowone:no-std
Dec 30, 2025
Merged

finish no_std clippy#6587
youknowone merged 1 commit intoRustPython:mainfrom
youknowone:no-std

Conversation

@youknowone
Copy link
Member

@youknowone youknowone commented Dec 30, 2025

close #6380
Finishing #6570

@terryluan12 Thank you so much!

Summary by CodeRabbit

  • Refactor
    • Updated internal library imports across multiple modules to align with core and alloc architecture patterns, maintaining all existing functionality and public APIs.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 30, 2025

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.

@youknowone youknowone force-pushed the no-std branch 2 times, most recently from ff9be11 to 2cd23ca Compare December 30, 2025 05:21
@github-actions
Copy link
Contributor

Code has been automatically formatted

The code in this PR has been formatted using cargo fmt --all.
Please pull the latest changes before pushing again:

git pull origin no-std

@youknowone
Copy link
Member Author

@terryluan12 Okay, There are more place to finish. Could you try a final touch? Now CI will automatically run, so you will get faster feedback than before.

@youknowone youknowone marked this pull request as ready for review December 30, 2025 06:14
@youknowone youknowone merged commit dac236d into RustPython:main Dec 30, 2025
13 checks passed
@youknowone youknowone deleted the no-std branch December 30, 2025 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add clippy rules to better align with #[no_std]

1 participant