clippy: Fix warnings in components/webgpu/wgpu_thread.rs (#32392)

* clippy: Fix warnings in `components/webgpu/wgpu_thread.rs`

Signed-off-by: Jujumba <far77578@gmail.com>

* clippy: `test-tidy` failure in `components/webgpu/wgpu_thread.rs`

Signed-off-by: Jujumba <far77578@gmail.com>

---------

Signed-off-by: Jujumba <far77578@gmail.com>
This commit is contained in:
Farid 2024-05-31 08:49:57 +02:00 committed by GitHub
parent 5a7891fbed
commit 0ccf129be0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -192,8 +192,7 @@ impl WGPU {
.get(&command_encoder_id) .get(&command_encoder_id)
{ {
Err(Error::Internal(err.clone())) Err(Error::Internal(err.clone()))
} else { } else if let Some(error) =
if let Some(error) =
gfx_select!(command_encoder_id => global.command_encoder_finish( gfx_select!(command_encoder_id => global.command_encoder_finish(
command_encoder_id, command_encoder_id,
&wgt::CommandBufferDescriptor::default() &wgt::CommandBufferDescriptor::default()
@ -203,8 +202,8 @@ impl WGPU {
Err(Error::from_error(error)) Err(Error::from_error(error))
} else { } else {
Ok(()) Ok(())
}
}; };
self.encoder_record_error(command_encoder_id, &result); self.encoder_record_error(command_encoder_id, &result);
self.maybe_dispatch_error(device_id, result.err()); self.maybe_dispatch_error(device_id, result.err());
}, },
@ -734,7 +733,7 @@ impl WGPU {
))) )))
} else { } else {
gfx_select!(queue_id => global.queue_submit(queue_id, &command_buffers)) gfx_select!(queue_id => global.queue_submit(queue_id, &command_buffers))
.map_err(|e| Error::from_error(e)) .map_err(Error::from_error)
}; };
self.maybe_dispatch_error(queue_id.transmute(), result.err()); self.maybe_dispatch_error(queue_id.transmute(), result.err());
}, },
@ -1083,13 +1082,11 @@ impl WGPU {
error_scope.errors error_scope.errors
); );
} }
} else { } else if let Err(e) = sender.send(Some(Ok(
if let Err(e) = sender.send(Some(Ok(
WebGPUResponse::PoppedErrorScope(Err(PopError::Empty)), WebGPUResponse::PoppedErrorScope(Err(PopError::Empty)),
))) { ))) {
warn!("Unable to send PopError::Empty: {e:?}"); warn!("Unable to send PopError::Empty: {e:?}");
} }
}
} else { } else {
// device lost // device lost
if let Err(e) = sender.send(Some(Ok(WebGPUResponse::PoppedErrorScope( if let Err(e) = sender.send(Some(Ok(WebGPUResponse::PoppedErrorScope(
@ -1132,8 +1129,7 @@ impl WGPU {
.find(|error_scope| error_scope.filter == error.filter()) .find(|error_scope| error_scope.filter == error.filter())
{ {
error_scope.errors.push(error); error_scope.errors.push(error);
} else { } else if self
if self
.script_sender .script_sender
.send(WebGPUMsg::UncapturedError { .send(WebGPUMsg::UncapturedError {
device: WebGPUDevice(device_id), device: WebGPUDevice(device_id),
@ -1144,7 +1140,6 @@ impl WGPU {
{ {
warn!("Failed to send WebGPUMsg::UncapturedError: {error:?}"); warn!("Failed to send WebGPUMsg::UncapturedError: {error:?}");
} }
}
} // else device is lost } // else device is lost
} }