clippy: fixed various clippy warnings in components/scripts (#31960)

* fixed various clippy warnings

* fixed various clippy warnings

* fixed various clippy warnings

* fixed various clippy warnings
This commit is contained in:
Rosemary Ajayi 2024-04-01 08:25:42 +00:00 committed by GitHub
parent fd8235e409
commit 2f5a4354e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 7 additions and 7 deletions

View file

@ -1207,7 +1207,7 @@ impl CanvasState {
if sw == 0 || sh == 0 { if sw == 0 || sh == 0 {
return Err(Error::IndexSize); return Err(Error::IndexSize);
} }
ImageData::new(global, sw.abs() as u32, sh.abs() as u32, None) ImageData::new(global, sw.unsigned_abs(), sh.unsigned_abs(), None)
} }
// https://html.spec.whatwg.org/multipage/#dom-context-2d-createimagedata // https://html.spec.whatwg.org/multipage/#dom-context-2d-createimagedata

View file

@ -2863,7 +2863,7 @@ impl Activatable for HTMLInputElement {
fn filter_from_accept(s: &DOMString) -> Vec<FilterPattern> { fn filter_from_accept(s: &DOMString) -> Vec<FilterPattern> {
let mut filter = vec![]; let mut filter = vec![];
for p in split_commas(s) { for p in split_commas(s) {
if let Some('.') = p.chars().nth(0) { if let Some('.') = p.chars().next() {
filter.push(FilterPattern(p[1..].to_string())); filter.push(FilterPattern(p[1..].to_string()));
} else if let Some(exts) = mime_guess::get_mime_extensions_str(p) { } else if let Some(exts) = mime_guess::get_mime_extensions_str(p) {
for ext in exts { for ext in exts {

View file

@ -299,7 +299,7 @@ impl ResponseMethods for Response {
match *self.status.borrow() { match *self.status.borrow() {
Some(s) => { Some(s) => {
let status_num = s.as_u16(); let status_num = s.as_u16();
status_num >= 200 && status_num <= 299 (200..=299).contains(&status_num)
}, },
None => false, None => false,
} }

View file

@ -480,7 +480,7 @@ impl ServiceWorkerGlobalScope {
fn dispatch_activate(&self) { fn dispatch_activate(&self) {
let event = ExtendableEvent::new(self, atom!("activate"), false, false); let event = ExtendableEvent::new(self, atom!("activate"), false, false);
let event = (&*event).upcast::<Event>(); let event = (*event).upcast::<Event>();
self.upcast::<EventTarget>().dispatch_event(event); self.upcast::<EventTarget>().dispatch_event(event);
} }
} }

View file

@ -92,7 +92,7 @@ impl StylePropertyMapReadOnlyMethods for StylePropertyMapReadOnly {
} else { } else {
Ordering::Greater Ordering::Greater
} }
} else if let Ok(_) = custom_properties::parse_name(key2) { } else if custom_properties::parse_name(key2).is_ok() {
Ordering::Less Ordering::Less
} else { } else {
key1.cmp(key2) key1.cmp(key2)

View file

@ -1334,7 +1334,7 @@ impl XMLHttpRequest {
let mime = self let mime = self
.final_mime_type() .final_mime_type()
.as_ref() .as_ref()
.map(|m| normalize_type_string(&m.to_string())) .map(|m| normalize_type_string(m.as_ref()))
.unwrap_or("".to_owned()); .unwrap_or("".to_owned());
// Step 3, 4 // Step 3, 4

View file

@ -1110,7 +1110,7 @@ impl FetchResponseListener for ModuleContext {
} else { } else {
return Err(NetworkError::Internal(format!( return Err(NetworkError::Internal(format!(
"Failed to parse MIME type: {}", "Failed to parse MIME type: {}",
content_type.to_string() content_type
))); )));
} }
} else { } else {