Skip to content

Commit 065d65a

Browse files
committed
Fixed the 'ptr_arg' clippy warning
Relevant lint: https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
1 parent d868275 commit 065d65a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/ascii_art.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl<'a> Tokens<'a> {
155155
})
156156
}
157157
/// render a truncated line of tokens.
158-
fn render(self, colors: &Vec<Color>, start: usize, end: usize, bold: bool) -> String {
158+
fn render(self, colors: &[Color], start: usize, end: usize, bold: bool) -> String {
159159
assert!(start <= end);
160160
let mut width = end - start;
161161
let mut colored_segment = String::new();
@@ -169,7 +169,7 @@ impl<'a> Tokens<'a> {
169169
colored_segment.push(chr);
170170
}
171171
Token::Color(col) => {
172-
add_colored_segment(&mut whole_string, &colored_segment, color, bold);
172+
add_colored_segment(&mut whole_string, &colored_segment, *color, bold);
173173
colored_segment = String::new();
174174
color = colors.get(col as usize).unwrap_or(&Color::White);
175175
}
@@ -180,7 +180,7 @@ impl<'a> Tokens<'a> {
180180
};
181181
});
182182

183-
add_colored_segment(&mut whole_string, &colored_segment, color, bold);
183+
add_colored_segment(&mut whole_string, &colored_segment, *color, bold);
184184
(0..width).for_each(|_| whole_string.push(' '));
185185
whole_string
186186
}
@@ -198,8 +198,8 @@ fn succeed_when<I>(predicate: impl FnOnce(I) -> bool) -> impl FnOnce(I) -> Optio
198198
}
199199
}
200200

201-
fn add_colored_segment(base: &mut String, segment: &String, color: &Color, bold: bool) {
202-
let mut colored_segment = segment.color(*color);
201+
fn add_colored_segment(base: &mut String, segment: &str, color: Color, bold: bool) {
202+
let mut colored_segment = segment.color(color);
203203
if bold {
204204
colored_segment = colored_segment.bold();
205205
}

0 commit comments

Comments
 (0)