8000 Use `Self` where possible by ShaharNaveh · Pull Request #5892 · RustPython/RustPython · GitHub
[go: up one dir, main page]

Skip to content

Use Self where possible #5892

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

Merged
merged 11 commits into from
Jul 4, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
More vm
  • Loading branch information
ShaharNaveh committed Jul 3, 2025
commit 728401d66c7197290e09e51dd2c00e806ed2344a
2 changes: 1 addition & 1 deletion vm/src/stdlib/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ mod sys {
#[cfg(feature = "threading")]
#[pyclass(with(PyStructSequence))]
impl PyThreadInfo {
const INFO: Self = PyThreadInfo {
const INFO: Self = Self {
name: crate::stdlib::thread::_thread::PYTHREAD_NAME,
// As I know, there's only way to use lock as "Mutex" in Rust
// with satisfying python document spec.
Expand Down
4 changes: 2 additions & 2 deletions vm/src/stdlib/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ pub(crate) mod _thread {
impl RLock {
#[pyslot]
fn slot_new(cls: PyTypeRef, _args: FuncArgs, vm: &VirtualMachine) -> PyResult {
RLock {
Self {
mu: RawRMutex::INIT,
}
.into_ref_with_type(vm, cls)
Expand Down Expand Up @@ -393,7 +393,7 @@ pub(crate) mod _thread {

#[pyslot]
fn slot_new(cls: PyTypeRef, _args: FuncArgs, vm: &VirtualMachine) -> PyResult {
Local {
Self {
data: ThreadLocal::new(),
}
.into_ref_with_type(vm, cls)
Expand Down
4 changes: 2 additions & 2 deletions vm/src/vm/thread.rs
< 4F85 /tr>
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl VirtualMachine {
#[cfg(feature = "threading")]
pub fn start_thread<F, R>(&self, f: F) -> std::thread::JoinHandle<R>
where
F: FnOnce(&VirtualMachine) -> R,
F: FnOnce(&Self) -> R,
F: Send + 'static,
R: Send + 'static,
{
Expand Down Expand Up @@ -146,7 +146,7 @@ impl VirtualMachine {
/// specific guaranteed behavior.
#[cfg(feature = "threading")]
pub fn new_thread(&self) -> ThreadedVirtualMachine {
let vm = VirtualMachine {
let vm = Self {
builtins: self.builtins.clone(),
sys_module: self.sys_module.clone(),
ctx: self.ctx.clone(),
Expand Down
0