X Tutup
Skip to content

Commit 6c12152

Browse files
authored
rustfmt (RustPython#7390)
1 parent 82e9b5d commit 6c12152

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

crates/vm/src/object/core.rs

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,7 @@ const _: () = assert!(core::mem::align_of::<ObjExt>() >= core::mem::align_of::<P
331331
const _: () = assert!(
332332
core::mem::size_of::<WeakRefList>().is_multiple_of(core::mem::align_of::<WeakRefList>())
333333
);
334-
const _: () =
335-
assert!(core::mem::align_of::<WeakRefList>() >= core::mem::align_of::<PyInner<()>>());
334+
const _: () = assert!(core::mem::align_of::<WeakRefList>() >= core::mem::align_of::<PyInner<()>>());
336335

337336
/// This is an actual python object. It consists of a `typ` which is the
338337
/// python class, and carries some rust payload optionally. This rust
@@ -375,8 +374,7 @@ impl<T> PyInner<T> {
375374
#[inline(always)]
376375
pub(super) fn ext_ref(&self) -> Option<&ObjExt> {
377376
let (flags, member_count) = self.read_type_flags();
378-
let has_ext =
379-
flags.has_feature(crate::types::PyTypeFlags::HAS_DICT) || member_count > 0;
377+
let has_ext = flags.has_feature(crate::types::PyTypeFlags::HAS_DICT) || member_count > 0;
380378
if !has_ext {
381379
return None;
382380
}
@@ -387,8 +385,7 @@ impl<T> PyInner<T> {
387385
EXT_OFFSET
388386
};
389387
let self_addr = (self as *const Self as *const u8).addr();
390-
let ext_ptr =
391-
core::ptr::with_exposed_provenance::<ObjExt>(self_addr.wrapping_sub(offset));
388+
let ext_ptr = core::ptr::with_exposed_provenance::<ObjExt>(self_addr.wrapping_sub(offset));
392389
Some(unsafe { &*ext_ptr })
393390
}
394391

@@ -957,8 +954,8 @@ impl<T: PyPayload> PyInner<T> {
957954
unsafe fn dealloc(ptr: *mut Self) {
958955
unsafe {
959956
let (flags, member_count) = (*ptr).read_type_flags();
960-
let has_ext = flags.has_feature(crate::types::PyTypeFlags::HAS_DICT)
961-
|| member_count > 0;
957+
let has_ext =
958+
flags.has_feature(crate::types::PyTypeFlags::HAS_DICT) || member_count > 0;
962959
let has_weakref = flags.has_feature(crate::types::PyTypeFlags::HAS_WEAKREF);
963960

964961
if has_ext || has_weakref {
@@ -977,9 +974,8 @@ impl<T: PyPayload> PyInner<T> {
977974
.unwrap()
978975
.0;
979976
}
980-
let (combined, inner_offset) = layout
981-
.extend(core::alloc::Layout::new::<Self>())
982-
.unwrap();
977+
let (combined, inner_offset) =
978+
layout.extend(core::alloc::Layout::new::<Self>()).unwrap();
983979
let combined = combined.pad_to_align();
984980

985981
let alloc_ptr = (ptr as *mut u8).sub(inner_offset);
@@ -1045,9 +1041,8 @@ impl<T: PyPayload + core::fmt::Debug> PyInner<T> {
10451041
None
10461042
};
10471043

1048-
let (combined, inner_offset) = layout
1049-
.extend(core::alloc::Layout::new::<Self>())
1050-
.unwrap();
1044+
let (combined, inner_offset) =
1045+
layout.extend(core::alloc::Layout::new::<Self>()).unwrap();
10511046
let combined = combined.pad_to_align();
10521047

10531048
let alloc_ptr = unsafe { alloc::alloc::alloc(combined) };
@@ -1757,8 +1752,7 @@ impl PyObject {
17571752
// the pointer without clearing dict contents. The dict may still be
17581753
// referenced by other live objects (e.g. function.__globals__).
17591754
let (flags, member_count) = obj.0.read_type_flags();
1760-
let has_ext = flags.has_feature(crate::types::PyTypeFlags::HAS_DICT)
1761-
|| member_count > 0;
1755+
let has_ext = flags.has_feature(crate::types::PyTypeFlags::HAS_DICT) || member_count > 0;
17621756
if has_ext {
17631757
let has_weakref = flags.has_feature(crate::types::PyTypeFlags::HAS_WEAKREF);
17641758
let offset = if has_weakref {
@@ -1767,9 +1761,8 @@ impl PyObject {
17671761
EXT_OFFSET
17681762
};
17691763
let self_addr = (ptr as *const u8).addr();
1770-
let ext_ptr = core::ptr::with_exposed_provenance_mut::<ObjExt>(
1771-
self_addr.wrapping_sub(offset),
1772-
);
1764+
let ext_ptr =
1765+
core::ptr::with_exposed_provenance_mut::<ObjExt>(self_addr.wrapping_sub(offset));
17731766
let ext = unsafe { &mut *ext_ptr };
17741767
if let Some(old_dict) = ext.dict.take() {
17751768
// Get the dict ref before dropping InstanceDict

0 commit comments

Comments
 (0)
X Tutup