Skip to content

Commit

Permalink
Cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
alokedesai committed Sep 11, 2024
1 parent fb5c957 commit c321520
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion wgpu-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5627,7 +5627,7 @@ pub enum SurfaceStatus {
/// The surface under the swap chain is lost.
Lost,
/// The surface status is not known.
Unknown
Unknown,
}

/// Nanosecond timestamp used by the presentation engine.
Expand Down
2 changes: 1 addition & 1 deletion wgpu/src/api/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl Surface<'_> {
SurfaceStatus::Timeout => return Err(SurfaceError::Timeout),
SurfaceStatus::Outdated => return Err(SurfaceError::Outdated),
SurfaceStatus::Lost => return Err(SurfaceError::Lost),
SurfaceStatus::Unknown => return Err(SurfaceError::Other)
SurfaceStatus::Unknown => return Err(SurfaceError::Other),
};

let guard = self.config.lock();
Expand Down
2 changes: 1 addition & 1 deletion wgpu/src/api/surface_texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub enum SurfaceError {
/// There is no more memory left to allocate a new frame.
OutOfMemory,
/// Acquiring a texture failed for an unknown reason
Other
Other,
}
static_assertions::assert_impl_all!(SurfaceError: Send, Sync);

Expand Down
25 changes: 12 additions & 13 deletions wgpu/src/backend/wgpu_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ pub struct Surface {
configured_device: Mutex<Option<wgc::id::DeviceId>>,
/// The error sink with which to report errors.
/// `None` if the surface has not been configured.
error_sink: Mutex<Option<ErrorSink>>
error_sink: Mutex<Option<ErrorSink>>,
}

#[derive(Debug)]
Expand Down Expand Up @@ -741,19 +741,18 @@ impl crate::Context for ContextWgpuCore {
},
)
}
Err(err) => {
match surface_data.error_sink.lock().as_ref() {
Some(error_sink) => {
self.handle_error_nolabel(error_sink, err, "Surface::get_current_texture_view");
(None, SurfaceStatus::Unknown,
SurfaceOutputDetail {
surface_id: surface_data.id,
})
},
None => {
self.handle_error_fatal(err, "Surface::get_current_texture_view")
}
Err(err) => match surface_data.error_sink.lock().as_ref() {
Some(error_sink) => {
self.handle_error_nolabel(error_sink, err, "Surface::get_current_texture_view");
(
None,
SurfaceStatus::Unknown,
SurfaceOutputDetail {
surface_id: surface_data.id,
},
)
}
None => self.handle_error_fatal(err, "Surface::get_current_texture_view"),
},
}
}
Expand Down

0 comments on commit c321520

Please sign in to comment.