diff options
Diffstat (limited to 'iced_builder/src/main.rs')
| -rw-r--r-- | iced_builder/src/main.rs | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/iced_builder/src/main.rs b/iced_builder/src/main.rs index 8f3c3fb..437410a 100644 --- a/iced_builder/src/main.rs +++ b/iced_builder/src/main.rs @@ -65,11 +65,7 @@ impl App { }, ); - let config = match config_load { - Ok(config) => config, - Err(_) => Config::default(), - }; - + let config = config_load.unwrap_or_default(); let theme = config.selected_theme(); let mut task = Task::none(); @@ -83,7 +79,7 @@ impl App { } else { warning_dialog(format!( "The file {} does not exist, or isn't a file.", - path.to_string_lossy().to_string() + path.to_string_lossy() )); } } @@ -156,11 +152,10 @@ impl App { None, None, ) - .into() } Message::HandleNew(name, zones) => { let ids: Vec<Id> = zones.into_iter().map(|z| z.0).collect(); - if ids.len() > 0 { + if !ids.is_empty() { let action = Action::new( ids, &mut self.project.element_tree.clone(), @@ -172,7 +167,7 @@ impl App { ); match result { Ok(Some(ref element)) => { - self.project.element_tree = Some(element.clone()) + self.project.element_tree = Some(element.clone()); } Err(error) => error_dialog(error.to_string()), _ => {} @@ -189,11 +184,10 @@ impl App { None, None, ) - .into() } Message::HandleMove(element, zones) => { let ids: Vec<Id> = zones.into_iter().map(|z| z.0).collect(); - if ids.len() > 0 { + if !ids.is_empty() { let action = Action::new( ids, &mut self.project.element_tree.clone(), @@ -230,13 +224,11 @@ impl App { self.project = Project::new(); self.project_path = None; self.editor_content = text_editor::Content::new(); - } else { - if unsaved_changes_dialog("You have unsaved changes. Do you wish to discard these and create a new project?") { + } else if unsaved_changes_dialog("You have unsaved changes. Do you wish to discard these and create a new project?") { self.is_dirty = false; self.project = Project::new(); self.project_path = None; self.editor_content = text_editor::Content::new(); - } } } } @@ -249,12 +241,10 @@ impl App { Project::from_file(), Message::FileOpened, ); - } else { - if unsaved_changes_dialog("You have unsaved changes. Do you wish to discard these and open another project?") { + } else if unsaved_changes_dialog("You have unsaved changes. Do you wish to discard these and open another project?") { self.is_dirty = false; self.is_loading = true; return Task::perform(Project::from_file(), Message::FileOpened); - } } } } |
