mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
Fix clippy
This commit is contained in:
4 files changed
+9
-3
No files matched your search
@@ -56,6 +56,12 @@ pub struct OncePtr<T> {
|
||||
inner: PyAtomic<*mut T>,
|
||||
}
|
||||
|
||||
impl<T> Default for OncePtr<T> {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> OncePtr<T> {
|
||||
#[inline]
|
||||
pub fn new() -> Self {
|
||||
|
||||
@@ -245,7 +245,7 @@ impl<L: Link> LinkedList<L, L::Target> {
|
||||
|
||||
// === rustpython additions ===
|
||||
|
||||
pub fn iter<'a>(&'a self) -> impl Iterator<Item = &'a L::Target> {
|
||||
pub fn iter(&self) -> impl Iterator<Item = &L::Target> {
|
||||
std::iter::successors(self.head, |node| unsafe {
|
||||
L::pointers(*node).as_ref().get_next()
|
||||
})
|
||||
|
||||
@@ -605,7 +605,7 @@ impl<T: Clone> Dict<T> {
|
||||
};
|
||||
match slot {
|
||||
Some(entry) if entry.index == index_index => {
|
||||
if pred(&entry.value)? == false {
|
||||
if !pred(&entry.value)? {
|
||||
return Ok(ControlFlow::Break(None));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ impl WeakRefList {
|
||||
}
|
||||
|
||||
impl WeakListInner {
|
||||
fn iter<'a>(&'a self) -> impl Iterator<Item = &'a PyObjectView<PyWeak>> {
|
||||
fn iter(&self) -> impl Iterator<Item = &PyObjectView<PyWeak>> {
|
||||
self.list.iter().filter(|wr| wr.0.refcount.get() > 0)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user