@@ -4,7 +4,7 @@ use std::borrow::Cow;
44use std::io::Write;
55use syntect::highlighting;
66use terminal::as_terminal_escaped;
7−use {Colors, LineChange, LineChanges, Options, OutputComponent};
7+use {Colors, LineChange, LineChanges, Options};
88
99const PANEL_WIDTH: usize = 7;
1010
@@ -32,17 +32,11 @@ impl<'a> Printer<'a> {
3232 }
3333
3434 pub fn print_header(&mut self, filename: Option<&str>) -> Result<()> {
35− if !self.options
36− .output_components
37− .contains(&OutputComponent::Header)
38− {
35+ if !self.options.output_components.header() {
3936 return Ok(());
4037 }
4138
42− if self.options
43− .output_components
44− .contains(&OutputComponent::Grid)
45− {
39+ if self.options.output_components.grid() {
4640 self.print_horizontal_line('┬')?;
4741
4842 write!(
@@ -70,10 +64,7 @@ impl<'a> Printer<'a> {
7064 }
7165
7266 pub fn print_footer(&mut self) -> Result<()> {
73− if self.options
74− .output_components
75− .contains(&OutputComponent::Grid)
76− {
67+ if self.options.output_components.grid() {
7768 self.print_horizontal_line('┴')
7869 } else {
7970 Ok(())
@@ -98,9 +89,7 @@ impl<'a> Printer<'a> {
9889 ),
9990 ];
10091
101− let grid_requested = self.options
102− .output_components
103− .contains(&OutputComponent::Grid);
92+ let grid_requested = self.options.output_components.grid();
10493 write!(
10594 self.handle,
10695 "{}",
@@ -119,10 +108,7 @@ impl<'a> Printer<'a> {
119108 }
120109
121110 fn print_line_number<'s>(&self, line_number: usize) -> Option<Cow<'s, str>> {
122− if self.options
123− .output_components
124− .contains(&OutputComponent::Numbers)
125− {
111+ if self.options.output_components.numbers() {
126112 Some(
127113 self.colors
128114 .line_number
@@ -130,10 +116,7 @@ impl<'a> Printer<'a> {
130116 .to_string()
131117 .into(),
132118 )
133− } else if self.options
134− .output_components
135− .contains(&OutputComponent::Grid)
136− {
119+ } else if self.options.output_components.grid() {
137120 Some(" ".into())
138121 } else {
139122 None
@@ -141,10 +124,7 @@ impl<'a> Printer<'a> {
141124 }
142125
143126 fn print_git_marker<'s>(&self, line_number: usize) -> Option<Cow<'s, str>> {
144− if self.options
145− .output_components
146− .contains(&OutputComponent::Changes)
147− {
127+ if self.options.output_components.changes() {
148128 Some(
149129 if let Some(ref changes) = self.line_changes {
150130 match changes.get(&(line_number as u32)) {
@@ -159,10 +139,7 @@ impl<'a> Printer<'a> {
159139 }.to_string()
160140 .into(),
161141 )
162− } else if self.options
163− .output_components
164− .contains(&OutputComponent::Grid)
165− {
142+ } else if self.options.output_components.grid() {
166143 Some(" ".into())
167144 } else {
168145 None
@@ -170,10 +147,7 @@ impl<'a> Printer<'a> {
170147 }
171148
172149 fn print_line_border<'s>(&self) -> Option<Cow<'s, str>> {
173− if self.options
174− .output_components
175− .contains(&OutputComponent::Grid)
176− {
150+ if self.options.output_components.grid() {
177151 Some(self.colors.grid.paint("│").to_string().into())
178152 } else {
179153 None