1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 14:50:03 -04:00

Use a lot more let-else (#7582)

This commit is contained in:
Emil Ernerfeldt
2025-10-02 19:47:00 +02:00
committed by GitHub
parent 4c1f344ef8
commit bd45406fad
45 changed files with 812 additions and 847 deletions

View File

@@ -64,11 +64,11 @@ impl eframe::App for ImageViewer {
}
#[cfg(not(target_arch = "wasm32"))]
if ui.button("file…").clicked() {
if let Some(path) = rfd::FileDialog::new().pick_file() {
self.uri_edit_text = format!("file://{}", path.display());
self.current_uri = self.uri_edit_text.clone();
}
if ui.button("file…").clicked()
&& let Some(path) = rfd::FileDialog::new().pick_file()
{
self.uri_edit_text = format!("file://{}", path.display());
self.current_uri = self.uri_edit_text.clone();
}
});
});

View File

@@ -194,10 +194,10 @@ impl WrapApp {
};
#[cfg(feature = "persistence")]
if let Some(storage) = cc.storage {
if let Some(state) = eframe::get_value(storage, eframe::APP_KEY) {
slf.state = state;
}
if let Some(storage) = cc.storage
&& let Some(state) = eframe::get_value(storage, eframe::APP_KEY)
{
slf.state = state;
}
slf