clippy fixes for rust 1.52

This commit is contained in:
Emil Ernerfeldt 2021-05-06 20:49:22 +02:00
parent 29668b5128
commit 0d71017ad4
6 changed files with 70 additions and 77 deletions

View file

@ -141,9 +141,9 @@ impl ScrollArea {
Prepared { Prepared {
id, id,
state, state,
current_scroll_bar_width,
always_show_scroll, always_show_scroll,
inner_rect, inner_rect,
current_scroll_bar_width,
content_ui, content_ui,
} }
} }

View file

@ -311,7 +311,7 @@ fn color_picker_hsvag_2d(ui: &mut Ui, hsva: &mut HsvaGamma, alpha: Alpha) {
ui.label("Value"); ui.label("Value");
ui.end_row(); ui.end_row();
color_slider_2d(ui, v, s, |v, s| HsvaGamma { v, s, ..opaque }.into()); color_slider_2d(ui, v, s, |v, s| HsvaGamma { s, v, ..opaque }.into());
ui.label("Value / Saturation"); ui.label("Value / Saturation");
ui.end_row(); ui.end_row();
}); });

View file

@ -42,12 +42,12 @@ impl Default for Demos {
.to_owned(), .to_owned(),
); );
Self { open, demos } Self { demos, open }
} }
} }
impl Demos { impl Demos {
pub fn checkboxes(&mut self, ui: &mut Ui) { pub fn checkboxes(&mut self, ui: &mut Ui) {
let Self { open, demos } = self; let Self { demos, open } = self;
for demo in demos { for demo in demos {
let mut is_open = open.contains(demo.name()); let mut is_open = open.contains(demo.name());
ui.checkbox(&mut is_open, demo.name()); ui.checkbox(&mut is_open, demo.name());
@ -56,7 +56,7 @@ impl Demos {
} }
pub fn show(&mut self, ctx: &CtxRef) { pub fn show(&mut self, ctx: &CtxRef) {
let Self { open, demos } = self; let Self { demos, open } = self;
for demo in demos { for demo in demos {
let mut is_open = open.contains(demo.name()); let mut is_open = open.contains(demo.name());
demo.show(ctx, &mut is_open); demo.show(ctx, &mut is_open);

View file

@ -303,8 +303,7 @@ impl Painter {
} }
pub fn upload_pending_user_textures(&mut self, facade: &dyn glium::backend::Facade) { pub fn upload_pending_user_textures(&mut self, facade: &dyn glium::backend::Facade) {
for user_texture in &mut self.user_textures { for user_texture in self.user_textures.iter_mut().flatten() {
if let Some(user_texture) = user_texture {
if user_texture.gl_texture.is_none() { if user_texture.gl_texture.is_none() {
let pixels = std::mem::take(&mut user_texture.pixels); let pixels = std::mem::take(&mut user_texture.pixels);
let format = texture::SrgbFormat::U8U8U8U8; let format = texture::SrgbFormat::U8U8U8U8;
@ -314,5 +313,4 @@ impl Painter {
} }
} }
} }
}
} }

View file

@ -151,8 +151,7 @@ impl WebGlPainter {
fn upload_user_textures(&mut self) { fn upload_user_textures(&mut self) {
let gl = &self.gl; let gl = &self.gl;
for user_texture in &mut self.user_textures { for user_texture in self.user_textures.iter_mut().flatten() {
if let Some(user_texture) = user_texture {
if user_texture.gl_texture.is_none() { if user_texture.gl_texture.is_none() {
let pixels = std::mem::take(&mut user_texture.pixels); let pixels = std::mem::take(&mut user_texture.pixels);
@ -188,7 +187,6 @@ impl WebGlPainter {
} }
} }
} }
}
pub fn register_webgl_texture(&mut self, texture: WebGlTexture) -> egui::TextureId { pub fn register_webgl_texture(&mut self, texture: WebGlTexture) -> egui::TextureId {
let id = self.alloc_user_texture_index(); let id = self.alloc_user_texture_index();

View file

@ -153,9 +153,7 @@ impl WebGl2Painter {
fn upload_user_textures(&mut self) { fn upload_user_textures(&mut self) {
let gl = &self.gl; let gl = &self.gl;
for user_texture in self.user_textures.iter_mut().flatten() {
for user_texture in &mut self.user_textures {
if let Some(user_texture) = user_texture {
if user_texture.gl_texture.is_none() { if user_texture.gl_texture.is_none() {
let pixels = std::mem::take(&mut user_texture.pixels); let pixels = std::mem::take(&mut user_texture.pixels);
@ -191,7 +189,6 @@ impl WebGl2Painter {
} }
} }
} }
}
pub fn register_webgl_texture(&mut self, texture: WebGlTexture) -> egui::TextureId { pub fn register_webgl_texture(&mut self, texture: WebGlTexture) -> egui::TextureId {
let id = self.alloc_user_texture_index(); let id = self.alloc_user_texture_index();