removed duplicate code in save_config on main.rs
This commit is contained in:
parent
cb1b81c07f
commit
c7329b4dd3
1 changed files with 4 additions and 12 deletions
16
src/main.rs
16
src/main.rs
|
|
@ -111,13 +111,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
|
||||
let (config_handler, config) = match cosmic_config::Config::new(App::APP_ID, CONFIG_VERSION) {
|
||||
Ok(config_handler) => {
|
||||
let config = match Config::get_entry(&config_handler) {
|
||||
Ok(ok) => ok,
|
||||
Err((errs, config)) => {
|
||||
log::info!("errors loading config: {:?}", errs);
|
||||
config
|
||||
}
|
||||
};
|
||||
let config = Config::get_entry(&config_handler).unwrap_or_else(|(errs, config)| {
|
||||
log::info!("errors loading config: {:?}", errs);
|
||||
config
|
||||
});
|
||||
(Some(config_handler), config)
|
||||
}
|
||||
Err(err) => {
|
||||
|
|
@ -445,11 +442,6 @@ impl App {
|
|||
}
|
||||
|
||||
fn save_config(&mut self) -> Command<Message> {
|
||||
if let Some(ref config_handler) = self.config_handler {
|
||||
if let Err(err) = self.config.write_entry(config_handler) {
|
||||
log::error!("failed to save config: {}", err);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(ref config_handler) = self.config_handler {
|
||||
if let Err(err) = self.config.write_entry(config_handler) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue