mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
clippy: Fix type_complexity
warning in components/script/dom
(#33727)
* clippy: Fix type_complexity warning in components/script/dom Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> * Use destructure function only once Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> --------- Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
This commit is contained in:
parent
5079552f93
commit
476ebb92fb
1 changed files with 21 additions and 15 deletions
|
@ -52,6 +52,12 @@ pub struct Range {
|
||||||
associated_selections: DomRefCell<Vec<Dom<Selection>>>,
|
associated_selections: DomRefCell<Vec<Dom<Selection>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct ContainedChildren {
|
||||||
|
first_partially_contained_child: Option<DomRoot<Node>>,
|
||||||
|
last_partially_contained_child: Option<DomRoot<Node>>,
|
||||||
|
contained_children: Vec<DomRoot<Node>>,
|
||||||
|
}
|
||||||
|
|
||||||
impl Range {
|
impl Range {
|
||||||
fn new_inherited(
|
fn new_inherited(
|
||||||
start_container: &Node,
|
start_container: &Node,
|
||||||
|
@ -149,13 +155,7 @@ impl Range {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://dom.spec.whatwg.org/#concept-range-clone>
|
/// <https://dom.spec.whatwg.org/#concept-range-clone>
|
||||||
fn contained_children(
|
fn contained_children(&self) -> Fallible<ContainedChildren> {
|
||||||
&self,
|
|
||||||
) -> Fallible<(
|
|
||||||
Option<DomRoot<Node>>,
|
|
||||||
Option<DomRoot<Node>>,
|
|
||||||
Vec<DomRoot<Node>>,
|
|
||||||
)> {
|
|
||||||
let start_node = self.start_container();
|
let start_node = self.start_container();
|
||||||
let end_node = self.end_container();
|
let end_node = self.end_container();
|
||||||
// Steps 5-6.
|
// Steps 5-6.
|
||||||
|
@ -192,11 +192,11 @@ impl Range {
|
||||||
return Err(Error::HierarchyRequest);
|
return Err(Error::HierarchyRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok((
|
Ok(ContainedChildren {
|
||||||
first_contained_child,
|
first_partially_contained_child: first_contained_child,
|
||||||
last_contained_child,
|
last_partially_contained_child: last_contained_child,
|
||||||
contained_children,
|
contained_children,
|
||||||
))
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://dom.spec.whatwg.org/#concept-range-bp-set>
|
/// <https://dom.spec.whatwg.org/#concept-range-bp-set>
|
||||||
|
@ -583,8 +583,11 @@ impl RangeMethods for Range {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Steps 5-12.
|
// Steps 5-12.
|
||||||
let (first_contained_child, last_contained_child, contained_children) =
|
let ContainedChildren {
|
||||||
self.contained_children()?;
|
first_partially_contained_child: first_contained_child,
|
||||||
|
last_partially_contained_child: last_contained_child,
|
||||||
|
contained_children,
|
||||||
|
} = self.contained_children()?;
|
||||||
|
|
||||||
if let Some(child) = first_contained_child {
|
if let Some(child) = first_contained_child {
|
||||||
// Step 13.
|
// Step 13.
|
||||||
|
@ -697,8 +700,11 @@ impl RangeMethods for Range {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Steps 5-12.
|
// Steps 5-12.
|
||||||
let (first_contained_child, last_contained_child, contained_children) =
|
let ContainedChildren {
|
||||||
self.contained_children()?;
|
first_partially_contained_child: first_contained_child,
|
||||||
|
last_partially_contained_child: last_contained_child,
|
||||||
|
contained_children,
|
||||||
|
} = self.contained_children()?;
|
||||||
|
|
||||||
let (new_node, new_offset) = if start_node.is_inclusive_ancestor_of(&end_node) {
|
let (new_node, new_offset) = if start_node.is_inclusive_ancestor_of(&end_node) {
|
||||||
// Step 13.
|
// Step 13.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue