1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 21:30: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

@@ -193,12 +193,11 @@ impl crate::Storage for FileStorage {
fn save_to_disk(file_path: &PathBuf, kv: &HashMap<String, String>) {
profiling::function_scope!();
if let Some(parent_dir) = file_path.parent() {
if !parent_dir.exists() {
if let Err(err) = std::fs::create_dir_all(parent_dir) {
log::warn!("Failed to create directory {parent_dir:?}: {err}");
}
}
if let Some(parent_dir) = file_path.parent()
&& !parent_dir.exists()
&& let Err(err) = std::fs::create_dir_all(parent_dir)
{
log::warn!("Failed to create directory {parent_dir:?}: {err}");
}
match std::fs::File::create(file_path) {