pass clippy

This commit is contained in:
Evan Almloff committed 2022-04-17 08:43:15 -05:00
1 parent e9da4c0fb7
commit b79a58cc66
8 files changed
+73 -81

No files matched your search

+4 -4
View File
@@ -30,7 +30,7 @@ impl<'a> NodeView<'a> {
pub fn namespace(&self) -> Option<&'a str> {
self.mask
.namespace
.then(|| self.el().map(|el| el.namespace).flatten())
.then(|| self.el().and_then(|el| el.namespace))
.flatten()
}
@@ -39,7 +39,7 @@ impl<'a> NodeView<'a> {
.map(|el| el.attributes)
.unwrap_or_default()
.iter()
.filter(|a| self.mask.attritutes.contains_attribute(&a.name))
.filter(|a| self.mask.attritutes.contains_attribute(a.name))
}
pub fn text(&self) -> Option<&str> {
@@ -124,11 +124,11 @@ impl AttributeMask {
fn overlaps(&self, other: &Self) -> bool {
fn overlaps_iter(
mut self_iter: impl Iterator<Item = &'static str>,
self_iter: impl Iterator<Item = &'static str>,
mut other_iter: impl Iterator<Item = &'static str>,
) -> bool {
if let Some(mut other_attr) = other_iter.next() {
while let Some(self_attr) = self_iter.next() {
for self_attr in self_iter {
while other_attr < self_attr {
if let Some(attr) = other_iter.next() {
other_attr = attr;
+14 -16
View File
@@ -390,7 +390,7 @@ impl<S: State> RealDom<S> {
}
// push down state. To avoid calling reduce more times than nessisary start from the top and go down.
let mut to_push = nodes_updated.clone();
let mut to_push = nodes_updated;
while let Some(node_ref) = to_push.pop_front() {
let NodeRef {
id,
@@ -528,10 +528,10 @@ impl<S: State> RealDom<S> {
}
// this is safe because no node will have itself as a child
pub fn get_node_children_mut<'a>(
&'a mut self,
pub fn get_node_children_mut(
&mut self,
id: usize,
) -> Option<(&'a mut Node<S>, Vec<&'a mut Node<S>>)> {
) -> Option<(&mut Node<S>, Vec<&mut Node<S>>)> {
let ptr = self.nodes.as_mut_ptr();
unsafe {
if id >= self.nodes.len() {
@@ -546,7 +546,7 @@ impl<S: State> RealDom<S> {
.collect(),
_ => Vec::new(),
};
return Some((node, children));
Some((node, children))
} else {
None
}
@@ -555,24 +555,22 @@ impl<S: State> RealDom<S> {
}
// this is safe because no node will have itself as a parent
pub fn get_node_parent_mut<'a>(
&'a mut self,
pub fn get_node_parent_mut(
&mut self,
id: usize,
) -> Option<(&'a mut Node<S>, Option<&'a mut Node<S>>)> {
) -> Option<(&mut Node<S>, Option<&mut Node<S>>)> {
let ptr = self.nodes.as_mut_ptr();
unsafe {
let node = &mut *ptr.add(id);
if id >= self.nodes.len() {
None
} else if let Some(node) = node.as_mut() {
let parent = node
.parent
.map(|id| (&mut *ptr.add(id.0)).as_mut().unwrap());
Some((node, parent))
} else {
if let Some(node) = node.as_mut() {
let parent = node
.parent
.map(|id| (&mut *ptr.add(id.0)).as_mut().unwrap());
return Some((node, parent));
} else {
None
}
None
}
}
}
+8 -8
View File
@@ -1,4 +1,4 @@
use std::fmt::Debug;
use std::{cmp::Ordering, fmt::Debug};
use anymap::AnyMap;
use dioxus_core::VNode;
@@ -14,20 +14,20 @@ pub(crate) fn union_ordered_iter<T: Ord + Debug>(
let mut o_peekable = o_iter.peekable();
let mut v = Vec::with_capacity(new_len_guess);
while let Some(s_i) = s_peekable.peek() {
loop {
if let Some(o_i) = o_peekable.peek() {
if o_i > s_i {
while let Some(o_i) = o_peekable.peek() {
match o_i.cmp(s_i) {
Ordering::Greater => {
break;
} else if o_i < s_i {
}
Ordering::Less => {
v.push(o_peekable.next().unwrap());
}
} else {
break;
Ordering::Equal => (),
}
}
v.push(s_peekable.next().unwrap());
}
while let Some(o_i) = o_peekable.next() {
for o_i in o_peekable {
v.push(o_i);
}
for w in v.windows(2) {