Skip to content

Commit

Permalink
style: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
danielwerg committed Jul 28, 2024
1 parent 07b15a5 commit cae159b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ struct ConfiguationFileGeneral {
save_after_copy: Option<bool>,
default_hide_toolbars: Option<bool>,
primary_highlighter: Option<Highlighters>,
disable_notifications: Option<bool>
disable_notifications: Option<bool>,
}

#[derive(Deserialize)]
Expand Down
20 changes: 16 additions & 4 deletions src/sketch_board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ impl SketchBoard {

// TODO: we could support more data types
if !output_filename.ends_with(".png") {
log_result("The only supported format is png, but the filename does not end in png", !APP_CONFIG.read().disable_notifications());
log_result(
"The only supported format is png, but the filename does not end in png",
!APP_CONFIG.read().disable_notifications(),
);
return;
}

Expand All @@ -204,8 +207,14 @@ impl SketchBoard {
};

match fs::write(&output_filename, data) {
Err(e) => log_result(&format!("Error while saving file: {e}"), !APP_CONFIG.read().disable_notifications()),
Ok(_) => log_result(&format!("File saved to '{}'.", &output_filename), !APP_CONFIG.read().disable_notifications()),
Err(e) => log_result(
&format!("Error while saving file: {e}"),
!APP_CONFIG.read().disable_notifications(),
),
Ok(_) => log_result(
&format!("File saved to '{}'.", &output_filename),
!APP_CONFIG.read().disable_notifications(),
),
};
}

Expand Down Expand Up @@ -250,7 +259,10 @@ impl SketchBoard {
match result {
Err(e) => println!("Error saving {e}"),
Ok(()) => {
log_result("Copied to clipboard.", !APP_CONFIG.read().disable_notifications());
log_result(
"Copied to clipboard.",
!APP_CONFIG.read().disable_notifications(),
);

// TODO: rethink order and messaging patterns
if APP_CONFIG.read().save_after_copy() {
Expand Down

0 comments on commit cae159b

Please sign in to comment.