From fe4c337425e493c893430299e8aef5877b1ff751 Mon Sep 17 00:00:00 2001 From: Matus Mastena Date: Sat, 12 Sep 2026 18:26:02 +0200 Subject: [PATCH] Group the Fusion palette literals and mark the constructors must_use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Byte-pair separators in the hex colours, and #[must_use] on the four constructors, which return a value and do nothing else — dropping one is always a mistake rather than a choice. Found by clippy::pedantic. Only this file is touched: the same run reported ten thousand warnings across the tree, nearly all numeric cast lints that are load-bearing in geometry code, so fixing them wholesale is a separate decision rather than a drive-by. --- src/ui/style/fusion_theme.rs | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/ui/style/fusion_theme.rs b/src/ui/style/fusion_theme.rs index 19a0aed73..ba869c1da 100644 --- a/src/ui/style/fusion_theme.rs +++ b/src/ui/style/fusion_theme.rs @@ -41,43 +41,47 @@ fn rgb(hex: u32) -> Color { } /// Near-black chrome, white text, blue accent. +#[must_use] pub fn fusion_black() -> Theme { Theme::custom( FUSION_BLACK, Seed { - background: rgb(0x1A1A1A), - text: rgb(0xF2F2F2), - primary: rgb(0x0696D7), - success: rgb(0x4CAF50), - warning: rgb(0xFFB300), - danger: rgb(0xE53935), + background: rgb(0x1A_1A1A), + text: rgb(0xF2_F2F2), + primary: rgb(0x06_96D7), + success: rgb(0x4C_AF50), + warning: rgb(0xFF_B300), + danger: rgb(0xE5_3935), }, ) } /// The inverse: light chrome, near-black text. The accent darkens so it /// keeps its contrast against a light surface. +#[must_use] pub fn fusion_white() -> Theme { Theme::custom( FUSION_WHITE, Seed { - background: rgb(0xFAFAFA), - text: rgb(0x1A1A1A), - primary: rgb(0x0277BD), - success: rgb(0x2E7D32), - warning: rgb(0xE65100), - danger: rgb(0xC62828), + background: rgb(0xFA_FAFA), + text: rgb(0x1A_1A1A), + primary: rgb(0x02_77BD), + success: rgb(0x2E_7D32), + warning: rgb(0xE6_5100), + danger: rgb(0xC6_2828), }, ) } /// Both Fusion themes, in the order the theme picker should show them. +#[must_use] pub fn fusion_themes() -> Vec { vec![fusion_black(), fusion_white()] } /// The canvas colour a Fusion theme asks for, or `None` for any other theme. /// Keyed by name because `Theme::Custom` carries no discriminant to match on. +#[must_use] pub fn fusion_canvas(theme: &Theme) -> Option<[u8; 3]> { match theme.to_string().as_str() { FUSION_BLACK => Some(FUSION_BLACK_CANVAS),