diff --git a/common/src/boxvec.rs b/common/src/boxvec.rs index ca81b7510..520e50f24 100644 --- a/common/src/boxvec.rs +++ b/common/src/boxvec.rs @@ -468,8 +468,8 @@ pub struct Drain<'a, T> { vec: ptr::NonNull>, } -unsafe impl<'a, T: Sync> Sync for Drain<'a, T> {} -unsafe impl<'a, T: Sync> Send for Drain<'a, T> {} +unsafe impl Sync for Drain<'_, T> {} +unsafe impl Send for Drain<'_, T> {} impl Iterator for Drain<'_, T> { type Item = T; diff --git a/common/src/linked_list.rs b/common/src/linked_list.rs index 3941d2c83..3040bab0b 100644 --- a/common/src/linked_list.rs +++ b/common/src/linked_list.rs @@ -293,7 +293,7 @@ impl LinkedList { } } -impl<'a, T, F> Iterator for DrainFilter<'a, T, F> +impl Iterator for DrainFilter<'_, T, F> where T: Link, F: FnMut(&mut T::Target) -> bool, diff --git a/common/src/lock/immutable_mutex.rs b/common/src/lock/immutable_mutex.rs index 3f5eba787..0e8c6b794 100644 --- a/common/src/lock/immutable_mutex.rs +++ b/common/src/lock/immutable_mutex.rs @@ -45,7 +45,7 @@ impl<'a, R: RawMutex, T: ?Sized> ImmutableMappedMutexGuard<'a, R, T> { } } -impl<'a, R: RawMutex, T: ?Sized> Deref for ImmutableMappedMutexGuard<'a, R, T> { +impl Deref for ImmutableMappedMutexGuard<'_, R, T> { type Target = T; fn deref(&self) -> &Self::Target { // SAFETY: self.data is valid for the lifetime of the guard @@ -53,22 +53,20 @@ impl<'a, R: RawMutex, T: ?Sized> Deref for ImmutableMappedMutexGuard<'a, R, T> { } } -impl<'a, R: RawMutex, T: ?Sized> Drop for ImmutableMappedMutexGuard<'a, R, T> { +impl Drop for ImmutableMappedMutexGuard<'_, R, T> { fn drop(&mut self) { // SAFETY: An ImmutableMappedMutexGuard always holds the lock unsafe { self.raw.unlock() } } } -impl<'a, R: RawMutex, T: fmt::Debug + ?Sized> fmt::Debug for ImmutableMappedMutexGuard<'a, R, T> { +impl fmt::Debug for ImmutableMappedMutexGuard<'_, R, T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&**self, f) } } -impl<'a, R: RawMutex, T: fmt::Display + ?Sized> fmt::Display - for ImmutableMappedMutexGuard<'a, R, T> -{ +impl fmt::Display for ImmutableMappedMutexGuard<'_, R, T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(&**self, f) } diff --git a/common/src/lock/thread_mutex.rs b/common/src/lock/thread_mutex.rs index 1a5054264..46e324ea8 100644 --- a/common/src/lock/thread_mutex.rs +++ b/common/src/lock/thread_mutex.rs @@ -192,31 +192,31 @@ impl<'a, R: RawMutex, G: GetThreadId, T: ?Sized> ThreadMutexGuard<'a, R, G, T> { } } } -impl<'a, R: RawMutex, G: GetThreadId, T: ?Sized> Deref for ThreadMutexGuard<'a, R, G, T> { +impl Deref for ThreadMutexGuard<'_, R, G, T> { type Target = T; fn deref(&self) -> &T { unsafe { &*self.mu.data.get() } } } -impl<'a, R: RawMutex, G: GetThreadId, T: ?Sized> DerefMut for ThreadMutexGuard<'a, R, G, T> { +impl DerefMut for ThreadMutexGuard<'_, R, G, T> { fn deref_mut(&mut self) -> &mut T { unsafe { &mut *self.mu.data.get() } } } -impl<'a, R: RawMutex, G: GetThreadId, T: ?Sized> Drop for ThreadMutexGuard<'a, R, G, T> { +impl Drop for ThreadMutexGuard<'_, R, G, T> { fn drop(&mut self) { unsafe { self.mu.raw.unlock() } } } -impl<'a, R: RawMutex, G: GetThreadId, T: ?Sized + fmt::Display> fmt::Display - for ThreadMutexGuard<'a, R, G, T> +impl fmt::Display + for ThreadMutexGuard<'_, R, G, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(&**self, f) } } -impl<'a, R: RawMutex, G: GetThreadId, T: ?Sized + fmt::Debug> fmt::Debug - for ThreadMutexGuard<'a, R, G, T> +impl fmt::Debug + for ThreadMutexGuard<'_, R, G, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(&**self, f) @@ -259,31 +259,31 @@ impl<'a, R: RawMutex, G: GetThreadId, T: ?Sized> MappedThreadMutexGuard<'a, R, G } } } -impl<'a, R: RawMutex, G: GetThreadId, T: ?Sized> Deref for MappedThreadMutexGuard<'a, R, G, T> { +impl Deref for MappedThreadMutexGuard<'_, R, G, T> { type Target = T; fn deref(&self) -> &T { unsafe { self.data.as_ref() } } } -impl<'a, R: RawMutex, G: GetThreadId, T: ?Sized> DerefMut for MappedThreadMutexGuard<'a, R, G, T> { +impl DerefMut for MappedThreadMutexGuard<'_, R, G, T> { fn deref_mut(&mut self) -> &mut T { unsafe { self.data.as_mut() } } } -impl<'a, R: RawMutex, G: GetThreadId, T: ?Sized> Drop for MappedThreadMutexGuard<'a, R, G, T> { +impl Drop for MappedThreadMutexGuard<'_, R, G, T> { fn drop(&mut self) { unsafe { self.mu.unlock() } } } -impl<'a, R: RawMutex, G: GetThreadId, T: ?Sized + fmt::Display> fmt::Display - for MappedThreadMutexGuard<'a, R, G, T> +impl fmt::Display + for MappedThreadMutexGuard<'_, R, G, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(&**self, f) } } -impl<'a, R: RawMutex, G: GetThreadId, T: ?Sized + fmt::Debug> fmt::Debug - for MappedThreadMutexGuard<'a, R, G, T> +impl fmt::Debug + for MappedThreadMutexGuard<'_, R, G, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(&**self, f) diff --git a/jit/src/lib.rs b/jit/src/lib.rs index d982ce439..1d099635e 100644 --- a/jit/src/lib.rs +++ b/jit/src/lib.rs @@ -341,7 +341,7 @@ pub struct Args<'a> { code: &'a CompiledCode, } -impl<'a> Args<'a> { +impl Args<'_> { pub fn invoke(&self) -> Option { unsafe { self.code.invoke_raw(&self.cif_args) } } diff --git a/stdlib/src/posixsubprocess.rs b/stdlib/src/posixsubprocess.rs index 47e19d317..64e897b60 100644 --- a/stdlib/src/posixsubprocess.rs +++ b/stdlib/src/posixsubprocess.rs @@ -113,7 +113,7 @@ struct CharPtrSlice<'a> { slice: [*const libc::c_char], } -impl<'a> CharPtrSlice<'a> { +impl CharPtrSlice<'_> { fn as_ptr(&self) -> *const *const libc::c_char { self.slice.as_ptr() } diff --git a/stdlib/src/sqlite.rs b/stdlib/src/sqlite.rs index e24b7e475..a5d81e71a 100644 --- a/stdlib/src/sqlite.rs +++ b/stdlib/src/sqlite.rs @@ -1004,7 +1004,9 @@ mod _sqlite { ) } + // TODO: Make it build without clippy::manual_c_str_literals #[pymethod] + #[allow(clippy::manual_c_str_literals)] fn backup(zelf: &Py, args: BackupArgs, vm: &VirtualMachine) -> PyResult<()> { let BackupArgs { target, diff --git a/stdlib/src/ssl.rs b/stdlib/src/ssl.rs index dc64d1826..03222ff4f 100644 --- a/stdlib/src/ssl.rs +++ b/stdlib/src/ssl.rs @@ -1503,7 +1503,7 @@ mod bio { pub struct MemBioSlice<'a>(*mut sys::BIO, PhantomData<&'a [u8]>); - impl<'a> Drop for MemBioSlice<'a> { + impl Drop for MemBioSlice<'_> { fn drop(&mut self) { unsafe { sys::BIO_free_all(self.0); diff --git a/vm/src/object/ext.rs b/vm/src/object/ext.rs index ec8b59bda..f7247bc5e 100644 --- a/vm/src/object/ext.rs +++ b/vm/src/object/ext.rs @@ -500,21 +500,21 @@ pub struct PyLease<'a, T: PyObjectPayload> { inner: PyRwLockReadGuard<'a, PyRef>, } -impl<'a, T: PyObjectPayload + PyPayload> PyLease<'a, T> { +impl PyLease<'_, T> { #[inline(always)] pub fn into_owned(self) -> PyRef { self.inner.clone() } } -impl<'a, T: PyObjectPayload + PyPayload> Borrow for PyLease<'a, T> { +impl Borrow for PyLease<'_, T> { #[inline(always)] fn borrow(&self) -> &PyObject { self.inner.as_ref() } } -impl<'a, T: PyObjectPayload + PyPayload> Deref for PyLease<'a, T> { +impl Deref for PyLease<'_, T> { type Target = PyRef; #[inline(always)] fn deref(&self) -> &Self::Target { @@ -522,7 +522,7 @@ impl<'a, T: PyObjectPayload + PyPayload> Deref for PyLease<'a, T> { } } -impl<'a, T> fmt::Display for PyLease<'a, T> +impl fmt::Display for PyLease<'_, T> where T: PyPayload + fmt::Display, { diff --git a/vm/src/ospath.rs b/vm/src/ospath.rs index ac574339f..fe26f227d 100644 --- a/vm/src/ospath.rs +++ b/vm/src/ospath.rs @@ -179,7 +179,7 @@ impl<'a> IOErrorBuilder<'a> { } } -impl<'a> ToPyException for IOErrorBuilder<'a> { +impl ToPyException for IOErrorBuilder<'_> { fn to_pyexception(&self, vm: &VirtualMachine) -> PyBaseExceptionRef { let excp = self.error.to_pyexception(vm); diff --git a/vm/src/protocol/iter.rs b/vm/src/protocol/iter.rs index 36952916c..d9c49ed15 100644 --- a/vm/src/protocol/iter.rs +++ b/vm/src/protocol/iter.rs @@ -229,7 +229,7 @@ where _phantom: std::marker::PhantomData, } -unsafe impl<'a, T, O> Traverse for PyIterIter<'a, T, O> +unsafe impl Traverse for PyIterIter<'_, T, O> where O: Traverse + Borrow, { @@ -252,7 +252,7 @@ where } } -impl<'a, T, O> Iterator for PyIterIter<'a, T, O> +impl Iterator for PyIterIter<'_, T, O> where T: TryFromObject, O: Borrow, diff --git a/vm/src/protocol/number.rs b/vm/src/protocol/number.rs index 92636dc11..01829bb55 100644 --- a/vm/src/protocol/number.rs +++ b/vm/src/protocol/number.rs @@ -432,7 +432,7 @@ unsafe impl Traverse for PyNumber<'_> { } } -impl<'a> Deref for PyNumber<'a> { +impl Deref for PyNumber<'_> { type Target = PyObject; fn deref(&self) -> &Self::Target { diff --git a/vm/src/py_serde.rs b/vm/src/py_serde.rs index 10a2acc9c..b4b12e430 100644 --- a/vm/src/py_serde.rs +++ b/vm/src/py_serde.rs @@ -22,7 +22,7 @@ where pub fn deserialize<'de, D>( vm: &'de VirtualMachine, deserializer: D, -) -> Result<::Value, D::Error> +) -> Result< as DeserializeSeed<'de>>::Value, D::Error> where D: serde::Deserializer<'de>, { @@ -49,7 +49,7 @@ impl<'s> PyObjectSerializer<'s> { } } -impl<'s> serde::Serialize for PyObjectSerializer<'s> { +impl serde::Serialize for PyObjectSerializer<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, diff --git a/vm/src/recursion.rs b/vm/src/recursion.rs index c7b75e588..7392cca4d 100644 --- a/vm/src/recursion.rs +++ b/vm/src/recursion.rs @@ -23,7 +23,7 @@ impl<'vm> ReprGuard<'vm> { } } -impl<'vm> Drop for ReprGuard<'vm> { +impl Drop for ReprGuard<'_> { fn drop(&mut self) { self.vm.repr_guards.borrow_mut().remove(&self.id); } diff --git a/vm/src/stdlib/codecs.rs b/vm/src/stdlib/codecs.rs index b4051d5c4..71317bf48 100644 --- a/vm/src/stdlib/codecs.rs +++ b/vm/src/stdlib/codecs.rs @@ -107,7 +107,7 @@ mod _codecs { PyStr::is_ascii(self) } } - impl<'vm> encodings::ErrorHandler for ErrorsHandler<'vm> { + impl encodings::ErrorHandler for ErrorsHandler<'_> { type Error = PyBaseExceptionRef; type StrBuf = PyStrRef; type BytesBuf = PyBytesRef; diff --git a/vm/sre_engine/src/engine.rs b/vm/sre_engine/src/engine.rs index ca269c73d..77f4ccdf3 100644 --- a/vm/sre_engine/src/engine.rs +++ b/vm/sre_engine/src/engine.rs @@ -236,7 +236,7 @@ pub struct SearchIter<'a, S: StrDrive> { pub state: State, } -impl<'a, S: StrDrive> Iterator for SearchIter<'a, S> { +impl Iterator for SearchIter<'_, S> { type Item = (); fn next(&mut self) -> Option { diff --git a/vm/sre_engine/src/string.rs b/vm/sre_engine/src/string.rs index e3f14ef01..ca8b3179d 100644 --- a/vm/sre_engine/src/string.rs +++ b/vm/sre_engine/src/string.rs @@ -25,7 +25,7 @@ pub trait StrDrive: Copy { fn back_skip(cursor: &mut StringCursor, n: usize); } -impl<'a> StrDrive for &'a [u8] { +impl StrDrive for &[u8] { #[inline] fn count(&self) -> usize { self.len()