clippy: fix warnings in components/shared (#31565)

* clippy: fix some warnings in components/shared

* fix: unit tests

* fix: review comments
This commit is contained in:
eri 2024-03-08 16:28:19 +01:00 committed by GitHub
parent 3a5ca785d3
commit 43f44965cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 102 additions and 139 deletions

View file

@ -39,6 +39,7 @@ pub enum WebrenderImageHandlerType {
/// List of Webrender external images to be shared among all external image
/// consumers (WebGL, Media, WebGPU).
/// It ensures that external image identifiers are unique.
#[derive(Default)]
pub struct WebrenderExternalImageRegistry {
/// Map of all generated external images.
external_images: HashMap<ExternalImageId, WebrenderImageHandlerType>,
@ -47,13 +48,6 @@ pub struct WebrenderExternalImageRegistry {
}
impl WebrenderExternalImageRegistry {
pub fn new() -> Self {
Self {
external_images: HashMap::new(),
next_image_id: 0,
}
}
pub fn next_id(&mut self, handler_type: WebrenderImageHandlerType) -> ExternalImageId {
self.next_image_id += 1;
let key = ExternalImageId(self.next_image_id);
@ -84,7 +78,7 @@ pub struct WebrenderExternalImageHandlers {
impl WebrenderExternalImageHandlers {
pub fn new() -> (Self, Arc<Mutex<WebrenderExternalImageRegistry>>) {
let external_images = Arc::new(Mutex::new(WebrenderExternalImageRegistry::new()));
let external_images = Arc::new(Mutex::new(WebrenderExternalImageRegistry::default()));
(
Self {
webgl_handler: None,