Skip to content

Commit

Permalink
Fixed some Rust code structure and modified the workflow to fail if c…
Browse files Browse the repository at this point in the history
…lippy returns warnings (#569)

* Fixed someone else's mistakes

* workflow now fails if clippy returns warnings

* refactor: Make base title variable constant

---------

Co-authored-by: Liam <[email protected]>
  • Loading branch information
adamperkowski and lj3954 authored Sep 21, 2024
1 parent 59744e8 commit f2332a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
restore-keys: ${{ runner.os }}-cargo-index-

- name: Run cargo clippy
run: cargo clippy
run: cargo clippy -- -Dwarnings

- name: Run cargo fmt
run: cargo fmt --all --check
11 changes: 6 additions & 5 deletions tui/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use ratatui::{

const MIN_WIDTH: u16 = 77;
const MIN_HEIGHT: u16 = 19;
const TITLE: &str = concat!("Linux Toolbox - ", env!("BUILD_DATE"));

pub struct AppState {
/// Selected theme
Expand Down Expand Up @@ -243,11 +244,11 @@ impl AppState {
Style::new()
};

let title = format!(
"Linux Toolbox - {} {}",
env!("BUILD_DATE"),
self.multi_select.then(|| "[Multi-Select]").unwrap_or("")
);
let title = if self.multi_select {
&format!("{} [Multi-Select]", TITLE)
} else {
TITLE
};

#[cfg(feature = "tips")]
let bottom_title = Line::from(self.tip.bold().blue()).right_aligned();
Expand Down

0 comments on commit f2332a7

Please sign in to comment.