Skip to content

Commit 218e844

Browse files
gvozdvmozgubenfdking
authored andcommitted
refactor: simplify filename formatting by removing IntoStatus trait
1 parent c3db1d6 commit 218e844

File tree

1 file changed

+2
-27
lines changed

1 file changed

+2
-27
lines changed

crates/lib/src/cli/formatters.rs

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ impl OutputStreamFormatter {
185185
}
186186
}
187187

188-
fn format_filename(&self, filename: &str, success: impl IntoStatus) -> String {
189-
let status = success.into_status();
188+
fn format_filename(&self, filename: &str, success: bool) -> String {
189+
let status = if success { Status::Pass } else { Status::Fail };
190190

191191
let color = match status {
192192
Status::Pass | Status::Fixed => AnsiColor::Green,
@@ -264,31 +264,6 @@ impl OutputStreamFormatter {
264264
}
265265
}
266266

267-
pub trait IntoStatus {
268-
fn into_status(self) -> Status;
269-
}
270-
271-
impl IntoStatus for bool {
272-
fn into_status(self) -> Status {
273-
if self {
274-
Status::Pass
275-
} else {
276-
Status::Fail
277-
}
278-
}
279-
}
280-
281-
impl IntoStatus for (Status, bool) {
282-
fn into_status(self) -> Status {
283-
let (if_ok, is_ok) = self;
284-
if is_ok {
285-
if_ok
286-
} else {
287-
Status::Fail
288-
}
289-
}
290-
}
291-
292267
#[derive(Clone, Copy)]
293268
pub enum Status {
294269
Pass,

0 commit comments

Comments
 (0)