clippy: Fix op_ref warnings (#31900)

This commit is contained in:
Oluwatobi Sofela 2024-03-27 17:45:58 +01:00 committed by GitHub
parent 773e881971
commit da518823ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 15 additions and 19 deletions

View file

@ -638,7 +638,7 @@ pub fn get_desired_proto(
// constructor. CheckedUnwrapStatic is fine here, because we're looking for
// DOM constructors and those can't be cross-origin objects.
*new_target = CheckedUnwrapStatic(*new_target);
if !new_target.is_null() && &*new_target != &*original_new_target {
if !new_target.is_null() && *new_target != *original_new_target {
get_proto_id_for_new_target(new_target.handle())
} else {
None
@ -649,7 +649,7 @@ pub fn get_desired_proto(
let global = GetNonCCWObjectGlobal(*new_target);
let proto_or_iface_cache = get_proto_or_iface_array(global);
desired_proto.set((*proto_or_iface_cache)[proto_id as usize]);
if &*new_target != &*original_new_target && !JS_WrapObject(*cx, desired_proto.into()) {
if *new_target != *original_new_target && !JS_WrapObject(*cx, desired_proto.into()) {
return Err(());
}
return Ok(());

View file

@ -597,11 +597,7 @@ impl HTMLFormElementMethods for HTMLFormElement {
// Step 7-8
let mut names_vec: Vec<DOMString> = Vec::new();
for elem in sourced_names_vec.iter() {
if names_vec
.iter()
.find(|name| &**name == &*elem.name)
.is_none()
{
if names_vec.iter().find(|name| **name == *elem.name).is_none() {
names_vec.push(DOMString::from(&*elem.name));
}
}

View file

@ -628,7 +628,7 @@ impl HTMLScriptElement {
// Step 12.
let doc = document_from_node(self);
if self.parser_inserted.get() && &*self.parser_document != &*doc {
if self.parser_inserted.get() && *self.parser_document != *doc {
return;
}
@ -983,7 +983,7 @@ impl HTMLScriptElement {
pub fn execute(&self, result: ScriptResult) {
// Step 1.
let doc = document_from_node(self);
if self.parser_inserted.get() && &*doc != &*self.parser_document {
if self.parser_inserted.get() && *doc != *self.parser_document {
return;
}

View file

@ -125,7 +125,7 @@ impl MediaStreamMethods for MediaStream {
self.tracks
.borrow()
.iter()
.find(|x| x.id().id().to_string() == &*id)
.find(|x| x.id().id().to_string() == *id)
.map(|x| DomRoot::from_ref(&**x))
}

View file

@ -2018,7 +2018,7 @@ impl Node {
suppress_observers: SuppressObserver,
) {
node.owner_doc().add_script_and_layout_blocker();
debug_assert!(&*node.owner_doc() == &*parent.owner_doc());
debug_assert!(*node.owner_doc() == *parent.owner_doc());
debug_assert!(child.map_or(true, |child| Some(parent) ==
child.GetParentNode().as_deref()));

View file

@ -136,11 +136,11 @@ impl PaintWorkletGlobalScope {
arguments,
sender,
) => {
let cache_hit = (&*self.cached_name.borrow() == &name) &&
let cache_hit = (*self.cached_name.borrow() == name) &&
(self.cached_size.get() == size) &&
(self.cached_device_pixel_ratio.get() == device_pixel_ratio) &&
(&*self.cached_properties.borrow() == &properties) &&
(&*self.cached_arguments.borrow() == &arguments);
(*self.cached_properties.borrow() == properties) &&
(*self.cached_arguments.borrow() == arguments);
let result = if cache_hit {
debug!("Cache hit on paint worklet {}!", name);
self.cached_result.borrow().clone()
@ -165,9 +165,9 @@ impl PaintWorkletGlobalScope {
let _ = sender.send(result);
},
PaintWorkletTask::SpeculativelyDrawAPaintImage(name, properties, arguments) => {
let should_speculate = (&*self.cached_name.borrow() != &name) ||
(&*self.cached_properties.borrow() != &properties) ||
(&*self.cached_arguments.borrow() != &arguments);
let should_speculate = (*self.cached_name.borrow() != name) ||
(*self.cached_properties.borrow() != properties) ||
(*self.cached_arguments.borrow() != arguments);
if should_speculate {
let size = self.cached_size.get();
let device_pixel_ratio = self.cached_device_pixel_ratio.get();

View file

@ -125,7 +125,7 @@ impl TextTrackListMethods for TextTrackList {
self.dom_tracks
.borrow()
.iter()
.filter(|track| track.id() == &id_str)
.filter(|track| track.id() == id_str)
.next()
.map(|t| DomRoot::from_ref(&**t))
}

View file

@ -784,7 +784,7 @@ impl XRSessionMethods for XRSession {
.borrow()
.granted_features()
.iter()
.find(|f| &**f == s)
.find(|f| **f == s)
.is_none()
{
p.reject_error(Error::NotSupported);