8000 style: cargo fmt · RustPython/RustPython@8c0ba39 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8c0ba39

Browse files
committed
style: cargo fmt
1 parent d0aa47e commit 8c0ba39

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

vm/src/frame.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ impl ExecutingFrame<'_> {
353353
let result = self.execute_instruction(instr, vm);
354354
if matches!(instr, &bytecode::Instruction::ReturnValue) {
355355
// only do gc if after certain instruction(to be decided), so to avoid strange bugs?
356-
// it seems ReturnValue is safe enough& frequent enough to do gc() after execute it?
357-
// | &bytecode::Instruction::StoreLocal(..)
356+
// it seems ReturnValue is safe enough & frequent enough to do gc() after execute it?
357+
// &bytecode::Instruction::ReturnValue | &bytecode::Instruction::StoreLocal(..)
358358
#[cfg(feature = "gc")]
359359
{
360360
#[cfg(feature = "threading")]

vm/src/object/core.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,7 @@ unsafe impl GcTrace for PyObject {
252252
impl From<&PyInner<Erased>> for &PyObject {
253253
fn from(inner: &PyInner<Erased>) -> Self {
254254
// Safety: PyObject is #[repr(transparent)], so cast is safe
255-
unsafe {
256-
NonNull::from(inner).cast::<PyObject>().as_ref()
257-
}
255+
unsafe { NonNull::from(inner).cast::<PyObject>().as_ref() }
258256
}
259257
}
260258

@@ -647,9 +645,9 @@ impl Drop for PyWeak {
647645
fn drop(&mut self) {
648646
// we do NOT have actual exclusive access!
649647
// no clue if doing this actually reduces chance of UB
650-
// let me: &Self = self;
648+
let me: &Self = self;
651649
// deallocate&drop is handle by garbage collector, don't do it here.
652-
// me.drop_inner();
650+
me.drop_inner();
653651
}
654652
}
655653

@@ -877,7 +875,6 @@ impl PyObjectRef {
877875
}
878876

879877
impl PyObject {
880-
881878
#[inline(always)]
882879
fn weak_ref_list(&self) -> Option<&WeakRefList> {
883880
Some(&self.0.weak_list)
@@ -1183,11 +1180,11 @@ impl PyObject {
11831180
($ID: tt, $($TY: ty),*$(,)?) => {
11841181
$(
11851182
if TypeId::of::<$TY>()==$ID{
1186-
std::stringify!($TY)
1183+
String::from(std::stringify!($TY))
11871184
}
11881185
)else*
11891186
else{
1190-
"Unknown type"
1187+
format!("Unknown type, id={:?}", $ID)
11911188
}
11921189
};
11931190
}

vm/src/object/gc/collector_sync.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::time::Instant;
22
use std::{fmt, ops::Deref, ptr::NonNull};
33

4-
use crate::object::gc::{deadlock_handler, Color, GcObjPtr, GcStatus, GcTrace, GcObj, GcObjRef};
4+
use crate::object::gc::{deadlock_handler, Color, GcObj, GcObjPtr, GcObjRef, GcStatus, GcTrace};
55
use crate::PyObject;
66

77
use rustpython_common::{
@@ -120,7 +120,6 @@ impl std::fmt::Debug for CcSync {
120120

121121
// TODO: change to use PyInner<Erased> directly
122122

123-
124123
impl CcSync {
125124
thread_local! {
126125
/// assume any drop() impl doesn't create new thread, so gc only work in this one thread.

vm/src/object/gc/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ mod collector_sync;
44
mod header;
55
mod trace;
66

7+
use crate::PyObject;
78
pub use collector_sync::GcResult;
89
pub(crate) use collector_sync::{CcSync, GLOBAL_COLLECTOR};
910
pub(crate) use header::{Color, GcHeader};
1011
pub(crate) use trace::{GcObjPtr, GcStatus, GcTrace, TracerFn};
11-
use crate::PyObject;
1212
type GcObj = PyObject;
1313
type GcObjRef<'a> = &'a GcObj;
1414

0 commit comments

Comments
 (0)
0