Skip to content

Commit 27d0247

Browse files
committed
style: apply rustfmt sweep across phase 18 + 19 work
cargo fmt --all flagged 6 files touched during the Roles migration (Phase 18) and picker redesign (Phase 19) that weren't run through rustfmt. Purely stylistic — zero behaviour change. Keeps CI's 'Check formatting' step green.
1 parent 4bee3f1 commit 27d0247

6 files changed

Lines changed: 52 additions & 27 deletions

File tree

src/adapter/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,7 @@ pub trait ToolAdapter: Send + Sync {
166166
/// fastfetch, lazygit, ls_colors, nvim, zsh_highlight) keep working
167167
/// unchanged. Migrating those to honor the injected env is a separate
168168
/// follow-up.
169-
fn apply_theme_with_env(
170-
&self,
171-
theme: &ThemeVariant,
172-
_env: &SlateEnv,
173-
) -> Result<ApplyOutcome> {
169+
fn apply_theme_with_env(&self, theme: &ThemeVariant, _env: &SlateEnv) -> Result<ApplyOutcome> {
174170
self.apply_theme(theme)
175171
}
176172

src/brand/render_context.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ impl<'a> RenderContext<'a> {
8181
pub fn from_active_theme() -> Result<RenderContext<'static>> {
8282
let registry = ThemeRegistry::new()?;
8383
let configured_theme_id = current_theme_id()?;
84-
let resolved_theme_id =
85-
resolve_active_theme_id(configured_theme_id.as_deref(), &registry)?;
84+
let resolved_theme_id = resolve_active_theme_id(configured_theme_id.as_deref(), &registry)?;
8685
Ok(RenderContext::new(cached_theme_ref(resolved_theme_id)?))
8786
}
8887
}
@@ -118,7 +117,9 @@ fn cached_theme_ref(theme_id: &str) -> Result<&'static ThemeVariant> {
118117
static CACHED: OnceLock<Mutex<HashMap<String, &'static ThemeVariant>>> = OnceLock::new();
119118
let cache = CACHED.get_or_init(|| Mutex::new(HashMap::new()));
120119
{
121-
let guard = cache.lock().unwrap_or_else(|poisoned| poisoned.into_inner());
120+
let guard = cache
121+
.lock()
122+
.unwrap_or_else(|poisoned| poisoned.into_inner());
122123
if let Some(theme) = guard.get(theme_id) {
123124
return Ok(*theme);
124125
}
@@ -133,7 +134,9 @@ fn cached_theme_ref(theme_id: &str) -> Result<&'static ThemeVariant> {
133134
.clone();
134135
let leaked: &'static ThemeVariant = Box::leak(Box::new(theme));
135136

136-
let mut guard = cache.lock().unwrap_or_else(|poisoned| poisoned.into_inner());
137+
let mut guard = cache
138+
.lock()
139+
.unwrap_or_else(|poisoned| poisoned.into_inner());
137140
let theme = guard.entry(theme_id.to_string()).or_insert(leaked);
138141
Ok(*theme)
139142
}

src/brand/roles.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,10 @@ mod tests {
271271
let ctx = mock_context(&theme);
272272
let roles = Roles::new(&ctx);
273273
let out = roles.code("frosted");
274-
let bg = ctx.cached_pill_bg.as_deref().expect("truecolor mock caches pill bg");
274+
let bg = ctx
275+
.cached_pill_bg
276+
.as_deref()
277+
.expect("truecolor mock caches pill bg");
275278
assert!(
276279
out.contains(bg),
277280
"code pill should reuse the D-04 cached background, got: {out:?}"

src/cli/clean.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,10 @@ fn strip_starship_slate_palette(integration_path: &Path) -> Result<()> {
266266
changed = true;
267267
}
268268

269-
if let Some(palettes) = doc.get_mut("palettes").and_then(|value| value.as_table_mut()) {
269+
if let Some(palettes) = doc
270+
.get_mut("palettes")
271+
.and_then(|value| value.as_table_mut())
272+
{
270273
if palettes.remove("slate").is_some() {
271274
changed = true;
272275
}
@@ -298,8 +301,7 @@ fn strip_starship_slate_palette(integration_path: &Path) -> Result<()> {
298301
///
299302
/// Byte-oriented to preserve non-UTF-8 content elsewhere in the file.
300303
fn remove_kitty_managed_references(env: &SlateEnv) -> Result<()> {
301-
let integration_path =
302-
crate::adapter::KittyAdapter::resolve_config_path_with_env(env);
304+
let integration_path = crate::adapter::KittyAdapter::resolve_config_path_with_env(env);
303305
if !integration_path.exists() {
304306
return Ok(());
305307
}
@@ -329,7 +331,9 @@ fn remove_kitty_managed_references(env: &SlateEnv) -> Result<()> {
329331
}
330332
// Drop `listen_on unix:…/kitty-slate` — slate-owned socket marker.
331333
if trimmed.starts_with(b"listen_on")
332-
&& trimmed.windows(b"kitty-slate".len()).any(|w| w == b"kitty-slate")
334+
&& trimmed
335+
.windows(b"kitty-slate".len())
336+
.any(|w| w == b"kitty-slate")
333337
{
334338
continue;
335339
}

src/cli/picker/preview/blocks.rs

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,8 @@ pub fn render_palette_swatch(palette: &Palette, full: bool) -> String {
332332
// Background-cell helper: emits `ESC[48;2;R;G;B m` + `width` spaces + RESET.
333333
// On malformed palette hex (a theme-file bug, not a user-facing error)
334334
// we degrade to `width` uncolored spaces so layout stays stable.
335-
let push_cell = |out: &mut String, hex: &str, width: usize| {
336-
match PaletteRenderer::hex_to_rgb(hex) {
335+
let push_cell =
336+
|out: &mut String, hex: &str, width: usize| match PaletteRenderer::hex_to_rgb(hex) {
337337
Ok((r, g, b)) => {
338338
out.push_str(&format!("\x1b[48;2;{r};{g};{b}m"));
339339
for _ in 0..width {
@@ -346,8 +346,7 @@ pub fn render_palette_swatch(palette: &Palette, full: bool) -> String {
346346
out.push(' ');
347347
}
348348
}
349-
}
350-
};
349+
};
351350

352351
if !full {
353352
let mut out = String::with_capacity(128);
@@ -398,7 +397,14 @@ pub fn render_palette_swatch(palette: &Palette, full: bool) -> String {
398397
// the next cell. 10 cols also keeps the row aligned 1:1 with
399398
// pairs of the 5-col bg cells above (2 × 5 = 10 per label).
400399
const NAMES: [&str; 8] = [
401-
"rosewater", "red", "peach", "yellow", "green", "sky", "blue", "mauve",
400+
"rosewater",
401+
"red",
402+
"peach",
403+
"yellow",
404+
"green",
405+
"sky",
406+
"blue",
407+
"mauve",
402408
];
403409
out.push_str(&fg(&palette.foreground));
404410
for name in NAMES {
@@ -667,7 +673,14 @@ mod tests {
667673
assert_eq!(lines.len(), 2, "expected exactly 2 lines, got {lines:?}");
668674
let labels = lines[1];
669675
for name in [
670-
"rosewater", "red", "peach", "yellow", "green", "sky", "blue", "mauve",
676+
"rosewater",
677+
"red",
678+
"peach",
679+
"yellow",
680+
"green",
681+
"sky",
682+
"blue",
683+
"mauve",
671684
] {
672685
assert!(
673686
labels.contains(name),
@@ -676,7 +689,14 @@ mod tests {
676689
}
677690
// Names must appear in the locked order.
678691
let positions: Vec<_> = [
679-
"rosewater", "red", "peach", "yellow", "green", "sky", "blue", "mauve",
692+
"rosewater",
693+
"red",
694+
"peach",
695+
"yellow",
696+
"green",
697+
"sky",
698+
"blue",
699+
"mauve",
680700
]
681701
.iter()
682702
.map(|n| labels.find(n).unwrap_or(usize::MAX))
@@ -700,4 +720,3 @@ mod tests {
700720
insta::assert_snapshot!("palette_swatch_8_named_cells", stripped);
701721
}
702722
}
703-

src/cli/picker/preview/starship_fork.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ use std::process::{Command, Stdio};
2828
/// to `compose::self_draw_prompt_from_sample_tokens`.
2929
#[derive(Debug)]
3030
#[allow(dead_code)] // Plan 19-07 event_loop wiring removes the attribute.
31-
// Plan 19-08: `pub(crate)` → `pub` so integration tests can match on
32-
// the error variants (V-11 integration coverage for the V12 path-guard).
31+
// Plan 19-08: `pub(crate)` → `pub` so integration tests can match on
32+
// the error variants (V-11 integration coverage for the V12 path-guard).
3333
pub enum StarshipForkError {
3434
/// Either `which::which("starship")` failed OR the caller-injected
3535
/// `starship_bin` path doesn't exist on disk.
@@ -54,9 +54,9 @@ pub enum StarshipForkError {
5454
/// Returns the stdout (with zsh %{ %} prompt-width escapes stripped) on
5555
/// success. On any failure the caller should fall back to self-drawing.
5656
#[allow(dead_code)] // Plan 19-07 event_loop wiring removes the attribute.
57-
// Plan 19-08: `pub(crate)` → `pub` so integration + bench targets can
58-
// call the fork without a shim. Production callers inside the crate are
59-
// unaffected by the visibility bump.
57+
// Plan 19-08: `pub(crate)` → `pub` so integration + bench targets can
58+
// call the fork without a shim. Production callers inside the crate are
59+
// unaffected by the visibility bump.
6060
pub fn fork_starship_prompt(
6161
managed_toml: &Path,
6262
managed_dir: &Path,

0 commit comments

Comments
 (0)