Skip to content

Commit

Permalink
Extract draw actions to fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
coastalwhite committed Apr 6, 2024
1 parent 9e5979b commit a2d8547
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion extra/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ client_log_path = "/var/log/lemurs.client.log"

# At which point to point the cache. If you want to disable the cache globally
# you can use `/dev/null`.
cache_path = "/var/cache/lemurs";
cache_path = "/var/cache/lemurs"

# Disable all logging. This is overwritten by the `--no-log` flag.
do_log = true
Expand Down
22 changes: 11 additions & 11 deletions src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ impl LoginForm {
let username = self.widgets.username.clone();
let password = self.widgets.password.clone();

match terminal.draw(|f| {
let draw_action = terminal.draw(|f| {
let layout = Chunks::new(f);
login_form_render(
f,
Expand All @@ -365,12 +365,11 @@ impl LoginForm {
input_mode.get(),
status_message.get(),
);
}) {
Ok(_) => {}
Err(err) => {
error!("Failed to draw. Reason: {}", err);
std::process::exit(1);
}
});

if let Err(err) = draw_action {
error!("Failed to draw. Reason: {}", err);
std::process::exit(1);
}

let event_input_mode = input_mode.clone();
Expand Down Expand Up @@ -556,7 +555,7 @@ impl LoginForm {
while let Ok(request) = req_recv_channel.recv() {
match request {
UIThreadRequest::Redraw => {
match terminal.draw(|f| {
let draw_action = terminal.draw(|f| {
let layout = Chunks::new(f);
login_form_render(
f,
Expand All @@ -569,9 +568,10 @@ impl LoginForm {
input_mode.get(),
status_message.get(),
);
}) {
Ok(_) => {}
Err(err) => warn!("Failed to draw to screen. Reason: {err}"),
});

if let Err(err) = draw_action {
warn!("Failed to draw to screen. Reason: {err}");
}
}
UIThreadRequest::DisableTui => {
Expand Down

0 comments on commit a2d8547

Please sign in to comment.