clippy: Fix explicit_auto_deref warnings in components/script (#31837)

* clippy: Fix explicit auto-deref warnings

* clippy: Fix explicit auto-deref warnings

* refactor: Tidy up code

* refactor: Fix method not found errors
This commit is contained in:
Oluwatobi Sofela 2024-03-23 12:29:20 +01:00 committed by GitHub
parent 3fc157338e
commit 3c05b58221
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
62 changed files with 157 additions and 168 deletions

View file

@ -202,7 +202,7 @@ impl SelectionMethods for Selection {
// https://w3c.github.io/selection-api/#dom-selection-addrange
fn AddRange(&self, range: &Range) {
// Step 1
if !self.is_same_root(&*range.start_container()) {
if !self.is_same_root(&range.start_container()) {
return;
}
@ -319,9 +319,9 @@ impl SelectionMethods for Selection {
}
// Step 4
if !self.is_same_root(&*range.start_container()) {
if !self.is_same_root(&range.start_container()) {
// Step 5, and its following 8 and 9
self.set_range(&*Range::new(&self.document, node, offset, node, offset));
self.set_range(&Range::new(&self.document, node, offset, node, offset));
self.direction.set(Direction::Forwards);
} else {
let old_anchor_node = &*self.GetAnchorNode().unwrap(); // has range, therefore has anchor node
@ -335,7 +335,7 @@ impl SelectionMethods for Selection {
};
if is_old_anchor_before_or_equal {
// Step 6, and its following 8 and 9
self.set_range(&*Range::new(
self.set_range(&Range::new(
&self.document,
old_anchor_node,
old_anchor_offset,
@ -345,7 +345,7 @@ impl SelectionMethods for Selection {
self.direction.set(Direction::Forwards);
} else {
// Step 7, and its following 8 and 9
self.set_range(&*Range::new(
self.set_range(&Range::new(
&self.document,
node,
offset,
@ -394,7 +394,7 @@ impl SelectionMethods for Selection {
}
};
if is_focus_before_anchor {
self.set_range(&*Range::new(
self.set_range(&Range::new(
&self.document,
focus_node,
focus_offset,
@ -403,7 +403,7 @@ impl SelectionMethods for Selection {
));
self.direction.set(Direction::Backwards);
} else {
self.set_range(&*Range::new(
self.set_range(&Range::new(
&self.document,
anchor_node,
anchor_offset,
@ -428,7 +428,7 @@ impl SelectionMethods for Selection {
// Spec wording just says node length here, but WPT specifically
// wants number of children (the main difference is that it's 0
// for cdata).
self.set_range(&*Range::new(
self.set_range(&Range::new(
&self.document,
node,
0,