clippy: Fix more clippy warnings in components/scripts/dom (#31914)

* refrence to a reference

* refrence to a reference
This commit is contained in:
Rosemary Ajayi 2024-03-28 12:26:39 +01:00 committed by GitHub
parent 5aae820f6d
commit 3ddb47e902
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 11 additions and 11 deletions

View file

@ -131,7 +131,7 @@ impl URLSearchParamsMethods for URLSearchParams {
let list = self.list.borrow();
list.iter()
.find(|&kv| kv.0 == name.0)
.map(|ref kv| USVString(kv.1.clone()))
.map(|kv| USVString(kv.1.clone()))
}
// https://url.spec.whatwg.org/#dom-urlsearchparams-getall

View file

@ -293,7 +293,7 @@ impl Default for VertexAttribData {
impl VertexAttribData {
pub fn buffer(&self) -> Option<&WebGLBuffer> {
self.buffer.as_ref().map(|b| &**b)
self.buffer.as_deref()
}
pub fn max_vertices(&self) -> u32 {

View file

@ -86,7 +86,7 @@ pub trait VirtualMethods {
/// on this element.
fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue {
match self.super_type() {
Some(ref s) => s.parse_plain_attribute(name, value),
Some(s) => s.parse_plain_attribute(name, value),
_ => AttrValue::String(value.into()),
}
}
@ -94,7 +94,7 @@ pub trait VirtualMethods {
/// Called when a Node is appended to a tree, where 'tree_connected' indicates
/// whether the tree is part of a Document.
fn bind_to_tree(&self, context: &BindContext) {
if let Some(ref s) = self.super_type() {
if let Some(s) = self.super_type() {
s.bind_to_tree(context);
}
}
@ -104,14 +104,14 @@ pub trait VirtualMethods {
/// Implements removing steps:
/// <https://dom.spec.whatwg.org/#concept-node-remove-ext>
fn unbind_from_tree(&self, context: &UnbindContext) {
if let Some(ref s) = self.super_type() {
if let Some(s) = self.super_type() {
s.unbind_from_tree(context);
}
}
/// Called on the parent when its children are changed.
fn children_changed(&self, mutation: &ChildrenMutation) {
if let Some(ref s) = self.super_type() {
if let Some(s) = self.super_type() {
s.children_changed(mutation);
}
}
@ -125,7 +125,7 @@ pub trait VirtualMethods {
/// <https://dom.spec.whatwg.org/#concept-node-adopt-ext>
fn adopting_steps(&self, old_doc: &Document) {
if let Some(ref s) = self.super_type() {
if let Some(s) = self.super_type() {
s.adopting_steps(old_doc);
}
}
@ -137,7 +137,7 @@ pub trait VirtualMethods {
maybe_doc: Option<&Document>,
clone_children: CloneChildrenFlag,
) {
if let Some(ref s) = self.super_type() {
if let Some(s) = self.super_type() {
s.cloning_steps(copy, maybe_doc, clone_children);
}
}
@ -145,7 +145,7 @@ pub trait VirtualMethods {
/// Called on an element when it is popped off the stack of open elements
/// of a parser.
fn pop(&self) {
if let Some(ref s) = self.super_type() {
if let Some(s) = self.super_type() {
s.pop();
}
}

View file

@ -831,7 +831,7 @@ fn tokenize_open_features(features: DOMString) -> IndexMap<String, String> {
fn parse_open_feature_boolean(tokenized_features: &IndexMap<String, String>, name: &str) -> bool {
if let Some(value) = tokenized_features.get(name) {
// Step 1 & 2
if value == "" || value == "yes" {
if value.is_empty() || value == "yes" {
return true;
}
// Step 3 & 4

View file

@ -118,7 +118,7 @@ impl Worker {
let (devtools_sender, devtools_receiver) = ipc::channel().unwrap();
let worker_id = WorkerId(Uuid::new_v4());
if let Some(ref chan) = global.devtools_chan() {
if let Some(chan) = global.devtools_chan() {
let pipeline_id = global.pipeline_id();
let title = format!("Worker for {}", worker_url);
if let Some(browsing_context) = browsing_context {