1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 05:10:03 -04:00

Fix clippy 1.50 lints

This commit is contained in:
Emil Ernerfeldt
2021-02-12 17:40:53 +01:00
parent fc8b27807c
commit 5906bf7a87
3 changed files with 35 additions and 41 deletions

View File

@@ -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<u8> = 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<u8> = 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)

View File

@@ -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<u8> = 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<u8> = 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)