fix many clippy warnings (#33510)

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
This commit is contained in:
Gae24 2024-09-21 15:58:31 +02:00 committed by GitHub
parent 4e4b137eaa
commit f986160ed4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 29 additions and 34 deletions

View file

@ -98,7 +98,7 @@ fn find_python() -> PathBuf {
for name in &candidates {
// Command::new() allows us to omit the `.exe` suffix on windows
if Command::new(&name)
if Command::new(name)
.arg("--version")
.output()
.is_ok_and(|out| out.status.success())

View file

@ -96,7 +96,7 @@ impl GamepadHapticActuator {
}
Self {
reflector_: Reflector::new(),
gamepad_index: gamepad_index,
gamepad_index,
effects,
playing_effect_promise: DomRefCell::new(None),
sequence_id: Cell::new(0),

View file

@ -7,7 +7,7 @@ use std::collections::HashSet;
use std::default::Default;
use std::rc::Rc;
use std::sync::{Arc, Mutex};
use std::{char, i32, mem};
use std::{char, mem};
use app_units::{Au, AU_PER_PX};
use base::id::PipelineId;

View file

@ -656,9 +656,7 @@ impl LinkProcessingOptions {
assert!(!self.href.is_empty());
// Step 2. If options's destination is null, then return null.
let Some(destination) = self.destination else {
return None;
};
let destination = self.destination?;
// Step 3. Let url be the result of encoding-parsing a URL given options's href, relative to options's base URL.
// TODO: The spec passes a base url which is incompatible with the

View file

@ -478,7 +478,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
let name_str = name.as_str().ok_or(Error::Syntax)?;
// Step 5: If (name, value) is a forbidden request-header, then return.
if is_forbidden_request_header(name_str, &value) {
if is_forbidden_request_header(name_str, value) {
return Ok(());
}

View file

@ -114,11 +114,9 @@ impl XRReferenceSpaceEventMethods for XRReferenceSpaceEvent {
/// <https://www.w3.org/TR/webxr/#dom-xrreferencespaceevent-transform>
fn GetTransform(&self) -> Option<DomRoot<XRRigidTransform>> {
if let Some(ref transform) = self.transform {
Some(DomRoot::from_ref(&**transform))
} else {
None
}
self.transform
.as_ref()
.map(|transform| DomRoot::from_ref(&**transform))
}
/// <https://dom.spec.whatwg.org/#dom-event-istrusted>

View file

@ -99,13 +99,12 @@ impl FetchResponseListener for StylesheetContext {
fn process_request_eof(&mut self) {}
fn process_response(&mut self, metadata: Result<FetchMetadata, NetworkError>) {
if let Ok(FetchMetadata::Filtered { ref filtered, .. }) = metadata {
match *filtered {
FilteredMetadata::Opaque | FilteredMetadata::OpaqueRedirect(_) => {
self.origin_clean = false;
},
_ => {},
}
if let Ok(FetchMetadata::Filtered {
filtered: FilteredMetadata::Opaque | FilteredMetadata::OpaqueRedirect(_),
..
}) = metadata
{
self.origin_clean = false;
}
self.metadata = metadata.ok().map(|m| match m {