diff --git a/vm/src/obj/objsequence.rs b/vm/src/obj/objsequence.rs index fa63e52db..44100cb55 100644 --- a/vm/src/obj/objsequence.rs +++ b/vm/src/obj/objsequence.rs @@ -277,8 +277,8 @@ impl SimpleSeq for std::collections::VecDeque { pub fn seq_equal( vm: &VirtualMachine, - zelf: &dyn SimpleSeq, - other: &dyn SimpleSeq, + zelf: &impl SimpleSeq, + other: &impl SimpleSeq, ) -> PyResult { if zelf.len() == other.len() { for (a, b) in Iterator::zip(zelf.iter(), other.iter()) { @@ -295,7 +295,11 @@ pub fn seq_equal( } } -pub fn seq_lt(vm: &VirtualMachine, zelf: &dyn SimpleSeq, other: &dyn SimpleSeq) -> PyResult { +pub fn seq_lt( + vm: &VirtualMachine, + zelf: &impl SimpleSeq, + other: &impl SimpleSeq, +) -> PyResult { for (a, b) in Iterator::zip(zelf.iter(), other.iter()) { if let Some(v) = vm.bool_seq_lt(a.clone(), b.clone())? { return Ok(v); @@ -304,7 +308,11 @@ pub fn seq_lt(vm: &VirtualMachine, zelf: &dyn SimpleSeq, other: &dyn SimpleSeq) Ok(zelf.len() < other.len()) } -pub fn seq_gt(vm: &VirtualMachine, zelf: &dyn SimpleSeq, other: &dyn SimpleSeq) -> PyResult { +pub fn seq_gt( + vm: &VirtualMachine, + zelf: &impl SimpleSeq, + other: &impl SimpleSeq, +) -> PyResult { for (a, b) in Iterator::zip(zelf.iter(), other.iter()) { if let Some(v) = vm.bool_seq_gt(a.clone(), b.clone())? { return Ok(v); @@ -313,7 +321,11 @@ pub fn seq_gt(vm: &VirtualMachine, zelf: &dyn SimpleSeq, other: &dyn SimpleSeq) Ok(zelf.len() > other.len()) } -pub fn seq_ge(vm: &VirtualMachine, zelf: &dyn SimpleSeq, other: &dyn SimpleSeq) -> PyResult { +pub fn seq_ge( + vm: &VirtualMachine, + zelf: &impl SimpleSeq, + other: &impl SimpleSeq, +) -> PyResult { for (a, b) in Iterator::zip(zelf.iter(), other.iter()) { if let Some(v) = vm.bool_seq_gt(a.clone(), b.clone())? { return Ok(v); @@ -323,7 +335,11 @@ pub fn seq_ge(vm: &VirtualMachine, zelf: &dyn SimpleSeq, other: &dyn SimpleSeq) Ok(zelf.len() >= other.len()) } -pub fn seq_le(vm: &VirtualMachine, zelf: &dyn SimpleSeq, other: &dyn SimpleSeq) -> PyResult { +pub fn seq_le( + vm: &VirtualMachine, + zelf: &impl SimpleSeq, + other: &impl SimpleSeq, +) -> PyResult { for (a, b) in Iterator::zip(zelf.iter(), other.iter()) { if let Some(v) = vm.bool_seq_lt(a.clone(), b.clone())? { return Ok(v); @@ -365,7 +381,7 @@ impl<'a> Iterator for SeqMul<'a> { } impl ExactSizeIterator for SeqMul<'_> {} -pub fn seq_mul(seq: &dyn SimpleSeq, repetitions: isize) -> SeqMul { +pub fn seq_mul(seq: &impl SimpleSeq, repetitions: isize) -> SeqMul { SeqMul { seq, repetitions: repetitions.max(0) as usize, diff --git a/vm/src/obj/objtuple.rs b/vm/src/obj/objtuple.rs index 73ff95cb8..00a011504 100644 --- a/vm/src/obj/objtuple.rs +++ b/vm/src/obj/objtuple.rs @@ -189,9 +189,7 @@ impl PyTuple { #[pymethod(name = "__mul__")] fn mul(&self, counter: isize, vm: &VirtualMachine) -> PyObjectRef { - let new_elements = seq_mul(&self.as_slice(), counter) - .cloned() - .collect(); + let new_elements = seq_mul(&self.as_slice(), counter).cloned().collect(); vm.ctx.new_tuple(new_elements) }