Skip to content

Commit b86074d

Browse files
committed
Rename Style to Styles to avoid a name clash
1 parent 28b4b67 commit b86074d

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

src/options/style.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,22 @@ impl TerminalColours {
6060
}
6161

6262

63-
pub struct Style {
63+
/// **Styles**, which is already an overloaded term, is a pair of view option
64+
/// sets that happen to both be affected by `LS_COLORS` and `EXA_COLORS`.
65+
/// Because it’s better to only iterate through that once, the two are deduced
66+
/// together.
67+
pub struct Styles {
68+
69+
/// The colours to paint user interface elements, like the date column,
70+
/// and file kinds, such as directories.
6471
pub colours: Colours,
72+
73+
/// The colours to paint the names of files that match glob patterns
74+
/// (and the classify option).
6575
pub style: FileStyle,
6676
}
6777

68-
impl Style {
78+
impl Styles {
6979

7080
#[allow(trivial_casts)] // the "as Box<_>" stuff below warns about this for some reason
7181
pub fn deduce<V, TW>(matches: &MatchedFlags, vars: &V, widther: TW) -> Result<Self, Misfire>
@@ -80,7 +90,7 @@ impl Style {
8090

8191
let tc = TerminalColours::deduce(matches)?;
8292
if tc == Never || (tc == Automatic && widther().is_none()) {
83-
return Ok(Style {
93+
return Ok(Styles {
8494
colours: Colours::plain(),
8595
style: FileStyle { classify, exts: Box::new(NoFileColours) },
8696
});
@@ -101,14 +111,14 @@ impl Style {
101111
LSColors(exa.as_ref()).each_pair(|pair| {
102112
colours.set_exa(&pair);
103113
});
114+
let style = FileStyle { classify, exts };
115+
Ok(Styles { colours, style })
104116
}
105117

106118
let classify = Classify::deduce(matches)?;
107119
let exts = if colours.colourful { Box::new(FileExtensions) as Box<_> }
108120
else { Box::new(NoFileColours) as Box<_> };
109121

110-
let style = FileStyle { classify, exts };
111-
Ok(Style { colours, style })
112122
}
113123
}
114124

src/options/view.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ impl View {
1313

1414
/// Determine which view to use and all of that view’s arguments.
1515
pub fn deduce<V: Vars>(matches: &MatchedFlags, vars: &V) -> Result<View, Misfire> {
16-
use options::style::Style;
16+
use options::style::Styles;
1717

1818
let mode = Mode::deduce(matches, vars)?;
19-
let Style { colours, style } = Style::deduce(matches, vars, || *TERM_WIDTH)?;
19+
let Styles { colours, style } = Styles::deduce(matches, vars, || *TERM_WIDTH)?;
2020
Ok(View { mode, colours, style })
2121
}
2222
}

0 commit comments

Comments
 (0)