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:
@@ -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();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user