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,19 +192,18 @@ impl WGPU {
.get(&command_encoder_id) .get(&command_encoder_id)
{ {
Err(Error::Internal(err.clone())) Err(Error::Internal(err.clone()))
} else if let Some(error) =
gfx_select!(command_encoder_id => global.command_encoder_finish(
command_encoder_id,
&wgt::CommandBufferDescriptor::default()
))
.1
{
Err(Error::from_error(error))
} else { } else {
if let Some(error) = Ok(())
gfx_select!(command_encoder_id => global.command_encoder_finish(
command_encoder_id,
&wgt::CommandBufferDescriptor::default()
))
.1
{
Err(Error::from_error(error))
} else {
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,12 +1082,10 @@ 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
@ -1132,18 +1129,16 @@ 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), pipeline_id: device_scope.pipeline_id,
pipeline_id: device_scope.pipeline_id, error: error.clone(),
error: error.clone(), })
}) .is_err()
.is_err() {
{ warn!("Failed to send WebGPUMsg::UncapturedError: {error:?}");
warn!("Failed to send WebGPUMsg::UncapturedError: {error:?}");
}
} }
} // else device is lost } // else device is lost
} }