Fixed some clippy warnings in components (#32025)

* Fixed some clippy warnings in components

* Updated the simplification of bolean expressions in componets/script/dom/range.rs
This commit is contained in:
komuhangi 2024-04-10 10:50:01 +03:00 committed by GitHub
parent 245269c649
commit 89a4820519
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 15 additions and 18 deletions

View file

@ -1021,11 +1021,11 @@ impl RangeMethods for Range {
// Step 4.
let ancestor = self.CommonAncestorContainer();
let mut iter = start_node
let iter = start_node
.following_nodes(&ancestor)
.filter_map(DomRoot::downcast::<Text>);
while let Some(child) = iter.next() {
for child in iter {
if self.contains(child.upcast()) {
s.push_str(&child.upcast::<CharacterData>().Data());
}
@ -1189,9 +1189,8 @@ impl WeakRangeVec {
let move_start = node_is_start && range.start_offset() == offset;
let move_end = node_is_end && range.end_offset() == offset;
let remove_from_node = move_start && move_end ||
move_start && !node_is_end ||
move_end && !node_is_start;
let remove_from_node =
move_start && (move_end || !node_is_end) || move_end && !node_is_start;
let already_in_child = range.start().node() == child || range.end().node() == child;
let push_to_child = !already_in_child && (move_start || move_end);
@ -1252,9 +1251,8 @@ impl WeakRangeVec {
let move_start = node_is_start && start_offset > offset;
let move_end = node_is_end && end_offset > offset;
let remove_from_node = move_start && move_end ||
move_start && !node_is_end ||
move_end && !node_is_start;
let remove_from_node =
move_start && (move_end || !node_is_end) || move_end && !node_is_start;
let already_in_sibling =
range.start().node() == sibling || range.end().node() == sibling;