From 06d4c95d35cd7df3f324f1fac7f452a9ba9f4be4 Mon Sep 17 00:00:00 2001 From: Felipe Coury Date: Mon, 9 Feb 2026 00:49:46 -0300 Subject: [PATCH] style(tui): rustfmt --- codex-rs/tui/src/diff_render.rs | 8 ++----- codex-rs/tui/src/render/highlight.rs | 36 +++++++++++++++++++++------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/codex-rs/tui/src/diff_render.rs b/codex-rs/tui/src/diff_render.rs index 8a55d3e6ab..62a557746d 100644 --- a/codex-rs/tui/src/diff_render.rs +++ b/codex-rs/tui/src/diff_render.rs @@ -1037,10 +1037,7 @@ mod tests { "span ending exactly at max_cols should flush before next span: {result:?}" ); // First line should only contain the 'a' span. - let first_width: usize = result[0] - .iter() - .map(|s| s.content.chars().count()) - .sum(); + let first_width: usize = result[0].iter().map(|s| s.content.chars().count()).sum(); assert!( first_width <= 4, "first line should be at most 4 cols wide, got {first_width}" @@ -1108,8 +1105,7 @@ mod tests { panic!( "large diff should not have syntax-highlighted spans, \ got RGB color in style {:?} for {:?}", - span.style, - span.content, + span.style, span.content, ); } } diff --git a/codex-rs/tui/src/render/highlight.rs b/codex-rs/tui/src/render/highlight.rs index fda99f7c52..6c38530adc 100644 --- a/codex-rs/tui/src/render/highlight.rs +++ b/codex-rs/tui/src/render/highlight.rs @@ -53,8 +53,7 @@ fn validate_theme_name(name: Option<&str>, codex_home: Option<&Path>) -> Option< return None; } // Check for a custom .tmTheme file on disk. - let has_custom_file = codex_home - .is_some_and(|home| custom_theme_path(name, home).is_file()); + let has_custom_file = codex_home.is_some_and(|home| custom_theme_path(name, home).is_file()); if has_custom_file { return None; } @@ -284,7 +283,8 @@ pub(crate) fn highlight_code_to_lines(code: &str, lang: &str) -> Vec> = code.lines().map(|l| Line::from(l.to_string())).collect(); + let mut result: Vec> = + code.lines().map(|l| Line::from(l.to_string())).collect(); if result.is_empty() { result.push(Line::from(String::new())); } @@ -578,14 +578,20 @@ mod tests { let known = [ ("ansi", EmbeddedThemeName::Ansi), ("base16", EmbeddedThemeName::Base16), - ("base16-eighties-dark", EmbeddedThemeName::Base16EightiesDark), + ( + "base16-eighties-dark", + EmbeddedThemeName::Base16EightiesDark, + ), ("base16-mocha-dark", EmbeddedThemeName::Base16MochaDark), ("base16-ocean-dark", EmbeddedThemeName::Base16OceanDark), ("base16-ocean-light", EmbeddedThemeName::Base16OceanLight), ("base16-256", EmbeddedThemeName::Base16_256), ("catppuccin-frappe", EmbeddedThemeName::CatppuccinFrappe), ("catppuccin-latte", EmbeddedThemeName::CatppuccinLatte), - ("catppuccin-macchiato", EmbeddedThemeName::CatppuccinMacchiato), + ( + "catppuccin-macchiato", + EmbeddedThemeName::CatppuccinMacchiato, + ), ("catppuccin-mocha", EmbeddedThemeName::CatppuccinMocha), ("coldark-cold", EmbeddedThemeName::ColdarkCold), ("coldark-dark", EmbeddedThemeName::ColdarkDark), @@ -597,9 +603,18 @@ mod tests { ("inspired-github", EmbeddedThemeName::InspiredGithub), ("1337", EmbeddedThemeName::Leet), ("monokai-extended", EmbeddedThemeName::MonokaiExtended), - ("monokai-extended-bright", EmbeddedThemeName::MonokaiExtendedBright), - ("monokai-extended-light", EmbeddedThemeName::MonokaiExtendedLight), - ("monokai-extended-origin", EmbeddedThemeName::MonokaiExtendedOrigin), + ( + "monokai-extended-bright", + EmbeddedThemeName::MonokaiExtendedBright, + ), + ( + "monokai-extended-light", + EmbeddedThemeName::MonokaiExtendedLight, + ), + ( + "monokai-extended-origin", + EmbeddedThemeName::MonokaiExtendedOrigin, + ), ("nord", EmbeddedThemeName::Nord), ("one-half-dark", EmbeddedThemeName::OneHalfDark), ("one-half-light", EmbeddedThemeName::OneHalfLight), @@ -672,7 +687,10 @@ mod tests { let warning = validate_theme_name(Some("my-fancy"), Some(dir.path())); assert!(warning.is_some(), "should warn when theme file is absent"); let msg = warning.unwrap(); - assert!(msg.contains("my-fancy"), "warning should mention the theme name"); + assert!( + msg.contains("my-fancy"), + "warning should mention the theme name" + ); } #[test]