clippy: Fix assorted warnings in components/ (#31628)

* clippy: fix assorted warnings in `components/`

* fix: new and default

* fix: review comments
This commit is contained in:
eri 2024-03-13 09:31:58 +01:00 committed by GitHub
parent 0fda14263a
commit 03d64d0675
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 87 additions and 98 deletions

View file

@ -54,6 +54,7 @@ const DEVICE_POLL_INTERVAL: u64 = 100;
pub const PRESENTATION_BUFFER_COUNT: usize = 10;
#[derive(Debug, Deserialize, Serialize)]
#[allow(clippy::large_enum_variant)]
pub enum WebGPUResponse {
RequestAdapter {
adapter_info: wgt::AdapterInfo,
@ -330,6 +331,12 @@ impl WebGPU {
}
}
type WebGPUBufferMaps<'a> =
HashMap<id::BufferId, Rc<BufferMapInfo<'a, Option<WebGPUResponseResult>>>>;
type WebGPUPresentBufferMaps<'a> =
HashMap<id::BufferId, Rc<BufferMapInfo<'a, (Option<ErrorScopeId>, WebGPURequest)>>>;
#[allow(clippy::upper_case_acronyms)] // Name of the library
struct WGPU<'a> {
receiver: IpcReceiver<(Option<ErrorScopeId>, WebGPURequest)>,
sender: IpcSender<(Option<ErrorScopeId>, WebGPURequest)>,
@ -340,10 +347,9 @@ struct WGPU<'a> {
// Track invalid adapters https://gpuweb.github.io/gpuweb/#invalid
_invalid_adapters: Vec<WebGPUAdapter>,
// Buffers with pending mapping
buffer_maps: HashMap<id::BufferId, Rc<BufferMapInfo<'a, Option<WebGPUResponseResult>>>>,
buffer_maps: WebGPUBufferMaps<'a>,
// Presentation Buffers with pending mapping
present_buffer_maps:
HashMap<id::BufferId, Rc<BufferMapInfo<'a, (Option<ErrorScopeId>, WebGPURequest)>>>,
present_buffer_maps: WebGPUPresentBufferMaps<'a>,
//TODO: Remove this (https://github.com/gfx-rs/wgpu/issues/867)
error_command_encoders: RefCell<HashMap<id::CommandEncoderId, String>>,
webrender_api: RenderApi,