Skip to content

Commit 95fc027

Browse files
authored
Merge pull request RustPython#4080 from youknowone/nightly
Fix nightly build
2 parents c536de8 + 27040c0 commit 95fc027

File tree

12 files changed

+45
-27
lines changed

12 files changed

+45
-27
lines changed

common/src/linked_list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl<L: Link> LinkedList<L, L::Target> {
152152
pub fn push_front(&mut self, val: L::Handle) {
153153
// The value should not be dropped, it is being inserted into the list
154154
let val = ManuallyDrop::new(val);
155-
let ptr = L::as_raw(&*val);
155+
let ptr = L::as_raw(&val);
156156
assert_ne!(self.head, Some(ptr));
157157
unsafe {
158158
L::pointers(ptr).as_mut().set_next(self.head);

stdlib/src/array.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ mod array {
725725
if zelf.is(&obj) {
726726
w.imul(2, vm)
727727
} else if let Some(array) = obj.payload::<PyArray>() {
728-
w.iadd(&*array.read(), vm)
728+
w.iadd(&array.read(), vm)
729729
} else {
730730
let iter = ArgIterable::try_from_object(vm, obj)?;
731731
// zelf.extend_from_iterable(iter, vm)
@@ -1029,7 +1029,7 @@ mod array {
10291029
fn add(&self, other: PyObjectRef, vm: &VirtualMachine) -> PyResult<PyRef<Self>> {
10301030
if let Some(other) = other.payload::<PyArray>() {
10311031
self.read()
1032-
.add(&*other.read(), vm)
1032+
.add(&other.read(), vm)
10331033
.map(|array| PyArray::from(array).into_ref(vm))
10341034
} else {
10351035
Err(vm.new_type_error(format!(
@@ -1048,7 +1048,7 @@ mod array {
10481048
if zelf.is(&other) {
10491049
zelf.try_resizable(vm)?.imul(2, vm)?;
10501050
} else if let Some(other) = other.payload::<PyArray>() {
1051-
zelf.try_resizable(vm)?.iadd(&*other.read(), vm)?;
1051+
zelf.try_resizable(vm)?.iadd(&other.read(), vm)?;
10521052
} else {
10531053
return Err(vm.new_type_error(format!(
10541054
"can only extend array with array (not \"{}\")",
@@ -1104,7 +1104,7 @@ mod array {
11041104
let array_b = other.read();
11051105

11061106
// fast path for same ArrayContentType type
1107-
if let Ok(ord) = array_a.cmp(&*array_b) {
1107+
if let Ok(ord) = array_a.cmp(&array_b) {
11081108
return Ok(ord == Some(Ordering::Equal));
11091109
}
11101110

@@ -1187,7 +1187,7 @@ mod array {
11871187
let array_a = zelf.read();
11881188
let array_b = other.read();
11891189

1190-
let res = match array_a.cmp(&*array_b) {
1190+
let res = match array_a.cmp(&array_b) {
11911191
// fast path for same ArrayContentType type
11921192
Ok(partial_ord) => partial_ord.map_or(false, |ord| op.eval_ord(ord)),
11931193
Err(()) => {

stdlib/src/bisect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ mod _bisect {
116116
} else {
117117
a_mid
118118
};
119-
if x.rich_compare_bool(&*comp, PyComparisonOp::Lt, vm)? {
119+
if x.rich_compare_bool(&comp, PyComparisonOp::Lt, vm)? {
120120
hi = mid;
121121
} else {
122122
lo = mid + 1;

stdlib/src/fcntl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ mod fcntl {
6969
arg_len = s.len();
7070
buf.get_mut(..arg_len)
7171
.ok_or_else(|| vm.new_value_error("fcntl string arg too long".to_owned()))?
72-
.copy_from_slice(&*s)
72+
.copy_from_slice(&s)
7373
}
7474
let ret = unsafe { libc::fcntl(fd, cmd, buf.as_mut_ptr()) };
7575
if ret < 0 {

vm/src/builtins/bytearray.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl PyByteArray {
146146

147147
#[pymethod(magic)]
148148
fn add(&self, other: ArgBytesLike) -> Self {
149-
self.inner().add(&*other.borrow_buf()).into()
149+
self.inner().add(&other.borrow_buf()).into()
150150
}
151151

152152
#[pymethod(magic)]

vm/src/builtins/bytes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ impl PyBytes {
151151

152152
#[pymethod(magic)]
153153
fn add(&self, other: ArgBytesLike) -> Vec<u8> {
154-
self.inner.add(&*other.borrow_buf())
154+
self.inner.add(&other.borrow_buf())
155155
}
156156

157157
#[pymethod(magic)]

vm/src/builtins/list.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl PyList {
150150

151151
#[pymethod(magic)]
152152
fn iadd(zelf: PyRef<Self>, other: PyObjectRef, vm: &VirtualMachine) -> PyResult<PyRef<Self>> {
153-
let mut seq = extract_cloned(&*other, Ok, vm)?;
153+
let mut seq = extract_cloned(&other, Ok, vm)?;
154154
zelf.borrow_vec_mut().append(&mut seq);
155155
Ok(zelf)
156156
}
@@ -213,7 +213,7 @@ impl PyList {
213213
match SequenceIndex::try_from_borrowed_object(vm, needle, "list")? {
214214
SequenceIndex::Int(index) => self.borrow_vec_mut().setitem_by_index(vm, index, value),
215215
SequenceIndex::Slice(slice) => {
216-
let sec = extract_cloned(&*value, Ok, vm)?;
216+
let sec = extract_cloned(&value, Ok, vm)?;
217217
self.borrow_vec_mut().setitem_by_slice(vm, slice, &sec)
218218
}
219219
}

vm/src/exceptions.rs

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -910,18 +910,30 @@ fn system_exit_code(exc: PyBaseExceptionRef) -> Option<PyObjectRef> {
910910
})
911911
}
912912

913-
pub struct SerializeException<'s> {
914-
vm: &'s VirtualMachine,
913+
pub struct SerializeException<'vm, 's> {
914+
vm: &'vm VirtualMachine,
915915
exc: &'s PyBaseExceptionRef,
916916
}
917917

918-
impl<'s> SerializeException<'s> {
919-
pub fn new(vm: &'s VirtualMachine, exc: &'s PyBaseExceptionRef) -> Self {
918+
impl<'vm, 's> SerializeException<'vm, 's> {
919+
pub fn new(vm: &'vm VirtualMachine, exc: &'s PyBaseExceptionRef) -> Self {
920920
SerializeException { vm, exc }
921921
}
922922
}
923923

924-
impl serde::Serialize for SerializeException<'_> {
924+
pub struct SerializeExceptionOwned<'vm> {
925+
vm: &'vm VirtualMachine,
926+
exc: PyBaseExceptionRef,
927+
}
928+
929+
impl serde::Serialize for SerializeExceptionOwned<'_> {
930+
fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
931+
let Self { vm, exc } = self;
932+
SerializeException::new(vm, exc).serialize(s)
933+
}
934+
}
935+
936+
impl serde::Serialize for SerializeException<'_, '_> {
925937
fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
926938
use serde::ser::*;
927939

@@ -943,11 +955,17 @@ impl serde::Serialize for SerializeException<'_> {
943955
struc.serialize_field("traceback", &tbs)?;
944956
struc.serialize_field(
945957
"cause",
946-
&self.exc.cause().as_ref().map(|e| Self::new(self.vm, e)),
958+
&self
959+
.exc
960+
.cause()
961+
.map(|exc| SerializeExceptionOwned { vm: self.vm, exc }),
947962
)?;
948963
struc.serialize_field(
949964
"context",
950-
&self.exc.context().as_ref().map(|e| Self::new(self.vm, e)),
965+
&self
966+
.exc
967+
.context()
968+
.map(|exc| SerializeExceptionOwned { vm: self.vm, exc }),
951969
)?;
952970
struc.serialize_field("suppress_context", &self.exc.get_suppress_context())?;
953971

vm/src/function/buffer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl PyObject {
1818
f: impl FnOnce(&[u8]) -> R,
1919
) -> PyResult<R> {
2020
let buffer = PyBuffer::try_from_borrowed_object(vm, self)?;
21-
buffer.as_contiguous().map(|x| f(&*x)).ok_or_else(|| {
21+
buffer.as_contiguous().map(|x| f(&x)).ok_or_else(|| {
2222
vm.new_type_error("non-contiguous buffer is not a bytes-like object".to_owned())
2323
})
2424
}
@@ -31,7 +31,7 @@ impl PyObject {
3131
let buffer = PyBuffer::try_from_borrowed_object(vm, self)?;
3232
buffer
3333
.as_contiguous_mut()
34-
.map(|mut x| f(&mut *x))
34+
.map(|mut x| f(&mut x))
3535
.ok_or_else(|| {
3636
vm.new_type_error("buffer is not a read-write bytes-like object".to_owned())
3737
})
@@ -47,7 +47,7 @@ impl ArgBytesLike {
4747
where
4848
F: FnOnce(&[u8]) -> R,
4949
{
50-
f(&*self.borrow_buf())
50+
f(&self.borrow_buf())
5151
}
5252

5353
pub fn len(&self) -> usize {
@@ -89,7 +89,7 @@ impl ArgMemoryBuffer {
8989
where
9090
F: FnOnce(&mut [u8]) -> R,
9191
{
92-
f(&mut *self.borrow_buf_mut())
92+
f(&mut self.borrow_buf_mut())
9393
}
9494

9595
pub fn len(&self) -> usize {

vm/src/object/core.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ impl fmt::Debug for PyObjectRef {
837837
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
838838
// SAFETY: the vtable contains functions that accept payload types that always match up
839839
// with the payload of the object
840-
unsafe { ((*self).0.vtable.debug)(self, f) }
840+
unsafe { (self.0.vtable.debug)(self, f) }
841841
}
842842
}
843843

vm/src/stdlib/io.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2989,7 +2989,7 @@ mod _io {
29892989
if let Some((dec_buffer, dec_flags)) = dec_state {
29902990
// TODO: inplace append to bytes when refcount == 1
29912991
let mut next_input = dec_buffer.as_bytes().to_vec();
2992-
next_input.extend_from_slice(&*buf.borrow_buf());
2992+
next_input.extend_from_slice(&buf.borrow_buf());
29932993
self.snapshot = Some((dec_flags, PyBytes::from(next_input).into_ref(vm)));
29942994
}
29952995

@@ -3298,7 +3298,7 @@ mod _io {
32983298
let mut buf = self.buffer(vm)?;
32993299
let ret = buf
33003300
.cursor
3301-
.read(&mut *obj.borrow_buf_mut())
3301+
.read(&mut obj.borrow_buf_mut())
33023302
.map_err(|_| vm.new_value_error("Error readinto from Take".to_owned()))?;
33033303

33043304
Ok(ret)

vm/src/stdlib/itertools.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ mod decl {
235235
let mut cur = zelf.cur.write();
236236
let step = zelf.step.clone();
237237
let result = cur.clone();
238-
*cur = vm._iadd(&*cur, step.as_object())?;
238+
*cur = vm._iadd(&cur, step.as_object())?;
239239
Ok(PyIterReturn::Return(result.to_pyobject(vm)))
240240
}
241241
}

0 commit comments

Comments
 (0)