From 26a8d3d0616d845e6921b13cb2028c863e505575 Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Fri, 20 Sep 2024 20:07:01 +0200 Subject: [PATCH 1/3] Fixed someone else's mistakes --- tui/src/state.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tui/src/state.rs b/tui/src/state.rs index 2a8297470..0cccfb7e1 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -246,7 +246,11 @@ impl AppState { let title = format!( "Linux Toolbox - {} {}", env!("BUILD_DATE"), - self.multi_select.then(|| "[Multi-Select]").unwrap_or("") + if self.multi_select { + "[Multi-Select]" + } else { + "" + } ); #[cfg(feature = "tips")] From dd8d8ddf0b540a1f2445da509a9282bc556ebdac Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Fri, 20 Sep 2024 20:08:40 +0200 Subject: [PATCH 2/3] workflow now fails if clippy returns warnings --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b42553c2d..fd9e190ec 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -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 From 14b6b5bb532381717483b7dd69f6b8a5d7f954ea Mon Sep 17 00:00:00 2001 From: Liam Date: Sat, 21 Sep 2024 01:21:12 +0200 Subject: [PATCH 3/3] refactor: Make base title variable constant --- tui/src/state.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tui/src/state.rs b/tui/src/state.rs index 0cccfb7e1..fb13dee1a 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -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 @@ -243,15 +244,11 @@ impl AppState { Style::new() }; - let title = format!( - "Linux Toolbox - {} {}", - env!("BUILD_DATE"), - if self.multi_select { - "[Multi-Select]" - } else { - "" - } - ); + 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();