From 5906bf7a8712e79200e5f2307ad0162bbde15f23 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 12 Feb 2021 17:40:53 +0100 Subject: [PATCH] Fix clippy 1.50 lints --- egui_glium/src/painter.rs | 20 +++++++++----------- egui_web/src/webgl1.rs | 28 +++++++++++++--------------- egui_web/src/webgl2.rs | 28 +++++++++++++--------------- 3 files changed, 35 insertions(+), 41 deletions(-) diff --git a/egui_glium/src/painter.rs b/egui_glium/src/painter.rs index b55508d1..03515a2d 100644 --- a/egui_glium/src/painter.rs +++ b/egui_glium/src/painter.rs @@ -286,18 +286,16 @@ impl Painter { assert_eq!(size.0 * size.1, pixels.len()); if let egui::TextureId::User(id) = id { - if let Some(user_texture) = self.user_textures.get_mut(id as usize) { - if let Some(user_texture) = user_texture { - let pixels: Vec> = pixels - .chunks(size.0 as usize) - .map(|row| row.iter().map(|srgba| srgba.to_tuple()).collect()) - .collect(); + if let Some(Some(user_texture)) = self.user_textures.get_mut(id as usize) { + let pixels: Vec> = pixels + .chunks(size.0 as usize) + .map(|row| row.iter().map(|srgba| srgba.to_tuple()).collect()) + .collect(); - *user_texture = UserTexture { - pixels, - gl_texture: None, - }; - } + *user_texture = UserTexture { + pixels, + gl_texture: None, + }; } } } diff --git a/egui_web/src/webgl1.rs b/egui_web/src/webgl1.rs index b8ed31fe..21aec2a0 100644 --- a/egui_web/src/webgl1.rs +++ b/egui_web/src/webgl1.rs @@ -181,22 +181,20 @@ impl WebGlPainter { let index = self.alloc_user_texture_index(); assert_eq!(size.0 * size.1, srgba_pixels.len()); - if let Some(user_texture) = self.user_textures.get_mut(index) { - if let Some(user_texture) = user_texture { - let mut pixels: Vec = Vec::with_capacity(srgba_pixels.len() * 4); - for srgba in srgba_pixels { - pixels.push(srgba.r()); - pixels.push(srgba.g()); - pixels.push(srgba.b()); - pixels.push(srgba.a()); - } - - *user_texture = UserTexture { - size, - pixels, - gl_texture: None, - }; + if let Some(Some(user_texture)) = self.user_textures.get_mut(index) { + let mut pixels: Vec = Vec::with_capacity(srgba_pixels.len() * 4); + for srgba in srgba_pixels { + pixels.push(srgba.r()); + pixels.push(srgba.g()); + pixels.push(srgba.b()); + pixels.push(srgba.a()); } + + *user_texture = UserTexture { + size, + pixels, + gl_texture: None, + }; } egui::TextureId::User(index as u64) diff --git a/egui_web/src/webgl2.rs b/egui_web/src/webgl2.rs index c46ec25e..2d380859 100644 --- a/egui_web/src/webgl2.rs +++ b/egui_web/src/webgl2.rs @@ -171,22 +171,20 @@ impl WebGl2Painter { let index = self.alloc_user_texture_index(); assert_eq!(size.0 * size.1, srgba_pixels.len()); - if let Some(user_texture) = self.user_textures.get_mut(index) { - if let Some(user_texture) = user_texture { - let mut pixels: Vec = Vec::with_capacity(srgba_pixels.len() * 4); - for srgba in srgba_pixels { - pixels.push(srgba.r()); - pixels.push(srgba.g()); - pixels.push(srgba.b()); - pixels.push(srgba.a()); - } - - *user_texture = UserTexture { - size, - pixels, - gl_texture: None, - }; + if let Some(Some(user_texture)) = self.user_textures.get_mut(index) { + let mut pixels: Vec = Vec::with_capacity(srgba_pixels.len() * 4); + for srgba in srgba_pixels { + pixels.push(srgba.r()); + pixels.push(srgba.g()); + pixels.push(srgba.b()); + pixels.push(srgba.a()); } + + *user_texture = UserTexture { + size, + pixels, + gl_texture: None, + }; } egui::TextureId::User(index as u64)