Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clippy: Remove let bindings in components/script/dom #31908

Merged
merged 1 commit into from Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/script/dom/bindings/str.rs
Expand Up @@ -236,7 +236,7 @@ impl DOMString {
}

let first_non_whitespace = self.0.find(|ref c| !char::is_ascii_whitespace(c)).unwrap();
let _ = self.0.replace_range(0..first_non_whitespace, "");
self.0.replace_range(0..first_non_whitespace, "");
}

/// Validates this `DOMString` is a time string according to
Expand Down
6 changes: 3 additions & 3 deletions components/script/dom/htmlinputelement.rs
Expand Up @@ -1869,7 +1869,7 @@ impl HTMLInputElement {
let (chan, recv) = ipc::channel(self.global().time_profiler_chan().clone())
.expect("Error initializing channel");
let msg = FileManagerThreadMsg::SelectFiles(filter, chan, origin, opt_test_paths);
let _ = resource_threads
resource_threads
.send(CoreResourceMsg::ToFileManager(msg))
.unwrap();

Expand All @@ -1896,7 +1896,7 @@ impl HTMLInputElement {
let (chan, recv) = ipc::channel(self.global().time_profiler_chan().clone())
.expect("Error initializing channel");
let msg = FileManagerThreadMsg::SelectFile(filter, chan, origin, opt_test_path);
let _ = resource_threads
resource_threads
.send(CoreResourceMsg::ToFileManager(msg))
.unwrap();

Expand Down Expand Up @@ -2582,7 +2582,7 @@ impl VirtualMethods for HTMLInputElement {
{
if event.IsTrusted() {
let window = window_from_node(self);
let _ = window
window
.task_manager()
.user_interaction_task_source()
.queue_event(
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/htmltextareaelement.rs
Expand Up @@ -652,7 +652,7 @@ impl VirtualMethods for HTMLTextAreaElement {
} else if event.type_() == atom!("keypress") && !event.DefaultPrevented() {
if event.IsTrusted() {
let window = window_from_node(self);
let _ = window
window
.task_manager()
.user_interaction_task_source()
.queue_event(
Expand Down
3 changes: 1 addition & 2 deletions components/script/dom/mediasession.rs
Expand Up @@ -240,8 +240,7 @@ impl MediaSessionMethods for MediaSession {
if let Some(media_instance) = self.media_instance.get() {
media_instance.set_duration(state.duration.map(|v| *v).unwrap());
// If the playbackRate is not present or its value is null, set it to 1.0.
let _ =
media_instance.SetPlaybackRate(state.playbackRate.unwrap_or(Finite::wrap(1.0)))?;
media_instance.SetPlaybackRate(state.playbackRate.unwrap_or(Finite::wrap(1.0)))?;
// If the position is not present or its value is null, set it to zero.
media_instance.SetCurrentTime(state.position.unwrap_or(Finite::wrap(0.0)));
}
Expand Down
5 changes: 2 additions & 3 deletions components/script/dom/webgl2renderingcontext.rs
Expand Up @@ -4154,8 +4154,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
constants::UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES => unsafe {
let values = values.iter().map(|&v| v as u32).collect::<Vec<_>>();
rooted!(in(*cx) let mut result = ptr::null_mut::<JSObject>());
let _ = Uint32Array::create(*cx, CreateWith::Slice(&values), result.handle_mut())
.unwrap();
Uint32Array::create(*cx, CreateWith::Slice(&values), result.handle_mut()).unwrap();
ObjectValue(result.get())
},
constants::UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER |
Expand Down Expand Up @@ -4385,7 +4384,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
));

rooted!(in(*cx) let mut rval = ptr::null_mut::<JSObject>());
let _ = Int32Array::create(
Int32Array::create(
*cx,
CreateWith::Slice(&receiver.recv().unwrap()),
rval.handle_mut(),
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/webglframebuffer.rs
Expand Up @@ -982,7 +982,7 @@ impl WebGLFramebuffer {

impl Drop for WebGLFramebuffer {
fn drop(&mut self) {
let _ = self.delete(Operation::Fallible);
self.delete(Operation::Fallible);
}
}

Expand Down
22 changes: 9 additions & 13 deletions components/script/dom/webglrenderingcontext.rs
Expand Up @@ -2066,7 +2066,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
let format_ids = self.extension_manager.get_tex_compression_ids();

rooted!(in(*cx) let mut rval = ptr::null_mut::<JSObject>());
let _ = Uint32Array::create(*cx, CreateWith::Slice(&format_ids), rval.handle_mut())
Uint32Array::create(*cx, CreateWith::Slice(&format_ids), rval.handle_mut())
.unwrap();
return ObjectValue(rval.get());
},
Expand Down Expand Up @@ -2165,7 +2165,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
let (sender, receiver) = webgl_channel().unwrap();
self.send_command(WebGLCommand::GetParameterInt2(param, sender));
rooted!(in(*cx) let mut rval = ptr::null_mut::<JSObject>());
let _ = Int32Array::create(
Int32Array::create(
*cx,
CreateWith::Slice(&receiver.recv().unwrap()),
rval.handle_mut(),
Expand All @@ -2177,7 +2177,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
let (sender, receiver) = webgl_channel().unwrap();
self.send_command(WebGLCommand::GetParameterInt4(param, sender));
rooted!(in(*cx) let mut rval = ptr::null_mut::<JSObject>());
let _ = Int32Array::create(
Int32Array::create(
*cx,
CreateWith::Slice(&receiver.recv().unwrap()),
rval.handle_mut(),
Expand All @@ -2194,7 +2194,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
let (sender, receiver) = webgl_channel().unwrap();
self.send_command(WebGLCommand::GetParameterFloat2(param, sender));
rooted!(in(*cx) let mut rval = ptr::null_mut::<JSObject>());
let _ = Float32Array::create(
Float32Array::create(
*cx,
CreateWith::Slice(&receiver.recv().unwrap()),
rval.handle_mut(),
Expand All @@ -2206,7 +2206,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
let (sender, receiver) = webgl_channel().unwrap();
self.send_command(WebGLCommand::GetParameterFloat4(param, sender));
rooted!(in(*cx) let mut rval = ptr::null_mut::<JSObject>());
let _ = Float32Array::create(
Float32Array::create(
*cx,
CreateWith::Slice(&receiver.recv().unwrap()),
rval.handle_mut(),
Expand Down Expand Up @@ -3380,7 +3380,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
let value = [x, y, z, w];
unsafe {
rooted!(in(*cx) let mut result = ptr::null_mut::<JSObject>());
let _ = Float32Array::create(
Float32Array::create(
*cx,
CreateWith::Slice(&value),
result.handle_mut(),
Expand All @@ -3393,20 +3393,16 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
let value = [x, y, z, w];
unsafe {
rooted!(in(*cx) let mut result = ptr::null_mut::<JSObject>());
let _ = Int32Array::create(
*cx,
CreateWith::Slice(&value),
result.handle_mut(),
)
.unwrap();
Int32Array::create(*cx, CreateWith::Slice(&value), result.handle_mut())
.unwrap();
return ObjectValue(result.get());
}
},
VertexAttrib::Uint(x, y, z, w) => {
let value = [x, y, z, w];
unsafe {
rooted!(in(*cx) let mut result = ptr::null_mut::<JSObject>());
let _ = Uint32Array::create(
Uint32Array::create(
*cx,
CreateWith::Slice(&value),
result.handle_mut(),
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/window.rs
Expand Up @@ -783,7 +783,7 @@ impl WindowMethods for Window {
// which calls into https://html.spec.whatwg.org/multipage/#discard-a-document.
window.discard_browsing_context();

let _ = window.send_to_constellation(ScriptMsg::DiscardTopLevelBrowsingContext);
window.send_to_constellation(ScriptMsg::DiscardTopLevelBrowsingContext);
}
});
self.task_manager()
Expand Down
2 changes: 1 addition & 1 deletion components/script/script_module.rs
Expand Up @@ -1684,7 +1684,7 @@ fn fetch_single_module_script(
match document {
Some(doc) => doc.fetch_async(LoadType::Script(url), request, action_sender),
None => {
let _ = global
global
.resource_threads()
.sender()
.send(CoreResourceMsg::Fetch(
Expand Down