aboutsummaryrefslogtreecommitdiffstats
path: root/components/webgpu/wgpu_thread.rs
diff options
context:
space:
mode:
authorFarid <70100129+Jujumba@users.noreply.github.com>2024-05-31 08:49:57 +0200
committerGitHub <noreply@github.com>2024-05-31 06:49:57 +0000
commit0ccf129be027b39c1f9628f8a1be7283b5905d57 (patch)
treeaf7ae85f4de32ec65fad2ddaff63d5c784a378c6 /components/webgpu/wgpu_thread.rs
parent5a7891fbed9f13fc8c9f633ba225640a0fea718f (diff)
downloadservo-0ccf129be027b39c1f9628f8a1be7283b5905d57.tar.gz
servo-0ccf129be027b39c1f9628f8a1be7283b5905d57.zip
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>
Diffstat (limited to 'components/webgpu/wgpu_thread.rs')
-rw-r--r--components/webgpu/wgpu_thread.rs55
1 files changed, 25 insertions, 30 deletions
diff --git a/components/webgpu/wgpu_thread.rs b/components/webgpu/wgpu_thread.rs
index 51778693d1d..736dd78f812 100644
--- a/components/webgpu/wgpu_thread.rs
+++ b/components/webgpu/wgpu_thread.rs
@@ -192,19 +192,18 @@ impl WGPU {
.get(&command_encoder_id)
{
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 {
- 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 {
- Ok(())
- }
+ Ok(())
};
+
self.encoder_record_error(command_encoder_id, &result);
self.maybe_dispatch_error(device_id, result.err());
},
@@ -734,7 +733,7 @@ impl WGPU {
)))
} else {
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());
},
@@ -1083,12 +1082,10 @@ impl WGPU {
error_scope.errors
);
}
- } else {
- if let Err(e) = sender.send(Some(Ok(
- WebGPUResponse::PoppedErrorScope(Err(PopError::Empty)),
- ))) {
- warn!("Unable to send PopError::Empty: {e:?}");
- }
+ } else if let Err(e) = sender.send(Some(Ok(
+ WebGPUResponse::PoppedErrorScope(Err(PopError::Empty)),
+ ))) {
+ warn!("Unable to send PopError::Empty: {e:?}");
}
} else {
// device lost
@@ -1132,18 +1129,16 @@ impl WGPU {
.find(|error_scope| error_scope.filter == error.filter())
{
error_scope.errors.push(error);
- } else {
- if self
- .script_sender
- .send(WebGPUMsg::UncapturedError {
- device: WebGPUDevice(device_id),
- pipeline_id: device_scope.pipeline_id,
- error: error.clone(),
- })
- .is_err()
- {
- warn!("Failed to send WebGPUMsg::UncapturedError: {error:?}");
- }
+ } else if self
+ .script_sender
+ .send(WebGPUMsg::UncapturedError {
+ device: WebGPUDevice(device_id),
+ pipeline_id: device_scope.pipeline_id,
+ error: error.clone(),
+ })
+ .is_err()
+ {
+ warn!("Failed to send WebGPUMsg::UncapturedError: {error:?}");
}
} // else device is lost
}