clippy: remove unneeded return statements (#31923)

This commit is contained in:
Azhar Ismagulova 2024-03-28 16:17:47 +00:00 committed by GitHub
parent 7349ce5b6a
commit 0728378424
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 15 additions and 19 deletions

View file

@ -338,7 +338,7 @@ impl Callback for TransmitBodyPromiseRejectionHandler {
fn callback(&self, _cx: JSContext, _v: HandleValue, _realm: InRealm) { fn callback(&self, _cx: JSContext, _v: HandleValue, _realm: InRealm) {
// Step 5.4, the "rejection" steps. // Step 5.4, the "rejection" steps.
let _ = self.control_sender.send(BodyChunkRequest::Error); let _ = self.control_sender.send(BodyChunkRequest::Error);
return self.stream.stop_reading(); self.stream.stop_reading();
} }
} }

View file

@ -602,7 +602,7 @@ fn get_proto_id_for_new_target(new_target: HandleObject) -> Option<PrototypeList
let dom_class = &(*domjsclass).dom_class; let dom_class = &(*domjsclass).dom_class;
return Some(dom_class.interface_chain[dom_class.depth as usize]); return Some(dom_class.interface_chain[dom_class.depth as usize]);
} }
return None; None
} }
} }
@ -698,6 +698,6 @@ pub fn get_desired_proto(
} }
maybe_wrap_object(*cx, desired_proto); maybe_wrap_object(*cx, desired_proto);
return Ok(()); Ok(())
} }
} }

View file

@ -448,7 +448,7 @@ impl DOMString {
return Some(val); return Some(val);
} }
} }
return None; None
} }
/// <https://html.spec.whatwg.org/multipage/#best-representation-of-the-number-as-a-floating-point-number> /// <https://html.spec.whatwg.org/multipage/#best-representation-of-the-number-as-a-floating-point-number>

View file

@ -107,7 +107,7 @@ unsafe fn write_blob(
"Writing structured data for a blob failed in {:?}.", "Writing structured data for a blob failed in {:?}.",
owner.get_url() owner.get_url()
); );
return false; false
} }
unsafe extern "C" fn read_callback( unsafe extern "C" fn read_callback(
@ -134,7 +134,7 @@ unsafe extern "C" fn read_callback(
&mut *(closure as *mut StructuredDataHolder), &mut *(closure as *mut StructuredDataHolder),
); );
} }
return ptr::null_mut(); ptr::null_mut()
} }
unsafe extern "C" fn write_callback( unsafe extern "C" fn write_callback(

View file

@ -330,7 +330,7 @@ where
sender, sender,
)) ))
.unwrap(); .unwrap();
return p; p
} }
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothlescanfilterinit-canonicalizing // https://webbluetoothcg.github.io/web-bluetooth/#bluetoothlescanfilterinit-canonicalizing

View file

@ -2878,7 +2878,7 @@ impl ElementMethods for Element {
match self.as_maybe_activatable() { match self.as_maybe_activatable() {
Some(a) => { Some(a) => {
a.exit_formal_activation_state(); a.exit_formal_activation_state();
return Ok(()); Ok(())
}, },
None => Err(Error::NotSupported), None => Err(Error::NotSupported),
} }

View file

@ -286,11 +286,7 @@ impl Gamepad {
/// <https://www.w3.org/TR/gamepad/#dfn-gamepad-user-gesture> /// <https://www.w3.org/TR/gamepad/#dfn-gamepad-user-gesture>
pub fn contains_user_gesture(update_type: GamepadUpdateType) -> bool { pub fn contains_user_gesture(update_type: GamepadUpdateType) -> bool {
match update_type { match update_type {
GamepadUpdateType::Axis(_, value) => { GamepadUpdateType::Axis(_, value) => value.abs() > AXIS_TILT_THRESHOLD,
return value.abs() > AXIS_TILT_THRESHOLD; GamepadUpdateType::Button(_, value) => value > BUTTON_PRESS_THRESHOLD,
}, }
GamepadUpdateType::Button(_, value) => {
return value > BUTTON_PRESS_THRESHOLD;
},
};
} }

View file

@ -1143,7 +1143,7 @@ impl GlobalScope {
); );
} }
} else { } else {
return warn!("post_messageport_msg called on a global not managing any ports."); warn!("post_messageport_msg called on a global not managing any ports.");
} }
} }

View file

@ -800,7 +800,7 @@ where
} }
}, },
} }
return false; false
} }
fn receive_messages(&mut self) { fn receive_messages(&mut self) {

View file

@ -336,7 +336,7 @@ impl Minibrowser {
) -> bool { ) -> bool {
let need_update = browser.load_status() != self.load_status; let need_update = browser.load_status() != self.load_status;
self.load_status = browser.load_status(); self.load_status = browser.load_status();
return need_update; need_update
} }
/// Updates all fields taken from the given [WebViewManager], such as the location field. /// Updates all fields taken from the given [WebViewManager], such as the location field.
@ -349,6 +349,6 @@ impl Minibrowser {
// because logical OR would short-circuit if any of the functions return true. // because logical OR would short-circuit if any of the functions return true.
// We want to ensure that all functions are called. The "bitwise OR" operator // We want to ensure that all functions are called. The "bitwise OR" operator
// does not short-circuit. // does not short-circuit.
return self.update_location_in_toolbar(browser) | self.update_spinner_in_toolbar(browser); self.update_location_in_toolbar(browser) | self.update_spinner_in_toolbar(browser)
} }
} }