aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlimageelement.rs
diff options
context:
space:
mode:
authorAarya Khandelwal <119049564+Aaryakhandelwal@users.noreply.github.com>2024-03-21 12:44:12 +0530
committerGitHub <noreply@github.com>2024-03-21 07:14:12 +0000
commitda3288dd00c16f6c4ac18cd3b6ba87a2917978d1 (patch)
tree77d90e149f17137649c6331e330dc3445c4510f6 /components/script/dom/htmlimageelement.rs
parent5c0199b5687a5c0c1b2fe82235ca609c7d9ea614 (diff)
downloadservo-da3288dd00c16f6c4ac18cd3b6ba87a2917978d1.tar.gz
servo-da3288dd00c16f6c4ac18cd3b6ba87a2917978d1.zip
Clippy: Fixed clippy warnings in components/script/dom (#31801)
* fixed clippy warnings in htmlformelement.rs * Fixed clippy warnings * Fixed warnings related to matches! * made changes to compile "test-tidy" successfully
Diffstat (limited to 'components/script/dom/htmlimageelement.rs')
-rw-r--r--components/script/dom/htmlimageelement.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs
index 02edcd924cd..e6e876e5f11 100644
--- a/components/script/dom/htmlimageelement.rs
+++ b/components/script/dom/htmlimageelement.rs
@@ -704,10 +704,10 @@ impl HTMLImageElement {
/// <https://html.spec.whatwg.org/multipage/#normalise-the-source-densities>
fn normalise_source_densities(&self, source_set: &mut SourceSet, width: Option<Length>) {
// Step 1
- let mut source_size = &mut source_set.source_size;
+ let source_size = &mut source_set.source_size;
// Find source_size_length for Step 2.2
- let source_size_length = self.evaluate_source_size_list(&mut source_size, width);
+ let source_size_length = self.evaluate_source_size_list(source_size, width);
// Step 2
for imgsource in &mut source_set.image_sources {
@@ -721,7 +721,7 @@ impl HTMLImageElement {
imgsource.descriptor.den = Some(wid as f64 / source_size_length.to_f64_px());
} else {
//Step 2.3
- imgsource.descriptor.den = Some(1 as f64);
+ imgsource.descriptor.den = Some(1_f64);
}
}
}
@@ -947,7 +947,7 @@ impl HTMLImageElement {
.map_or(false, |p| p.is::<HTMLPictureElement>());
if src_set.is_empty() && !is_parent_picture && !src.is_empty() {
selected_source = Some(src.clone());
- pixel_density = Some(1 as f64);
+ pixel_density = Some(1_f64);
};
// Step 5
@@ -1579,7 +1579,7 @@ impl HTMLImageElementMethods for HTMLImageElement {
match *url {
Some(ref url) => USVString(url.clone().into_string()),
None => {
- let ref unparsed_url = current_request.source_url;
+ let unparsed_url = &current_request.source_url;
match *unparsed_url {
Some(ref url) => url.clone(),
None => USVString("".to_owned()),
@@ -1722,7 +1722,7 @@ impl VirtualMethods for HTMLImageElement {
}
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);
}
let document = document_from_node(self);
@@ -1761,7 +1761,7 @@ impl FormControl for HTMLImageElement {
self.form_owner.set(form);
}
- fn to_element<'a>(&'a self) -> &'a Element {
+ fn to_element(&self) -> &Element {
self.upcast::<Element>()
}