Skip to content

Commit c806ad9

Browse files
committed
refactor: rename maybe_color to maybe_colored
Rename maybe_color_slice -> maybe_colored_slice and maybe_color_tree_slice -> maybe_colored_tree_slice for clarity, as the names describe the result rather than the action. https://claude.ai/code/session_012139SmUSC1oYSKNkvsg78g
1 parent 36a3621 commit c806ad9

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/visualizer/coloring.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ impl<'a> Coloring<'a> {
1919

2020
/// Look up the color for a node identified by its path components and whether it has children,
2121
/// then wrap the given [`TreeHorizontalSlice`] in the appropriate colored or colorless variant.
22-
fn maybe_color_tree_slice(
22+
fn maybe_colored_tree_slice(
2323
&self,
2424
path_components: &[&'a OsStr],
2525
has_children: bool,
@@ -113,7 +113,7 @@ impl Width for ColoredTreeHorizontalSlice<'_> {
113113
///
114114
/// Path components are only constructed when coloring is enabled, avoiding
115115
/// unnecessary allocation in the common no-color case.
116-
pub(super) fn maybe_color_slice<'a, 'b>(
116+
pub(super) fn maybe_colored_slice<'a, 'b>(
117117
coloring: Option<&'b Coloring<'a>>,
118118
ancestors: impl Iterator<Item = &'a OsStr>,
119119
name: &'a OsStr,
@@ -123,7 +123,7 @@ pub(super) fn maybe_color_slice<'a, 'b>(
123123
match coloring {
124124
Some(coloring) => {
125125
let path_components: Vec<&OsStr> = ancestors.chain(std::iter::once(name)).collect();
126-
coloring.maybe_color_tree_slice(&path_components, has_children, slice)
126+
coloring.maybe_colored_tree_slice(&path_components, has_children, slice)
127127
}
128128
None => MaybeColoredTreeHorizontalSlice::Colorless(slice),
129129
}

src/visualizer/methods.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use node_info::*;
1212
use table::*;
1313
use tree_table::*;
1414

15-
use super::{coloring::maybe_color_slice, ColumnWidthDistribution, Visualizer};
15+
use super::{coloring::maybe_colored_slice, ColumnWidthDistribution, Visualizer};
1616
use crate::size;
1717
use std::{cmp::min, ffi::OsStr, fmt::Display};
1818
use zero_copy_pads::{align_left, align_right};
@@ -91,7 +91,7 @@ where
9191
tree_horizontal_slice,
9292
} = tree_row;
9393

94-
let tree = maybe_color_slice(
94+
let tree = maybe_colored_slice(
9595
self.coloring,
9696
initial_row.ancestors.iter().map(|node| node.name.as_ref()),
9797
initial_row.node_info.name.as_ref(),

0 commit comments

Comments
 (0)