Skip to content

Commit 03bdca4

Browse files
Copilotjosecelano
andcommitted
fix: [#124] address clippy warnings and apply rustfmt
Co-authored-by: josecelano <58816+josecelano@users.noreply.github.com>
1 parent e68b452 commit 03bdca4

File tree

1 file changed

+32
-8
lines changed

1 file changed

+32
-8
lines changed

src/presentation/user_output.rs

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ use std::io::Write;
7171
/// assert_eq!(theme.error_symbol(), "[x]");
7272
/// ```
7373
#[derive(Debug, Clone, PartialEq, Eq)]
74+
#[allow(clippy::struct_field_names)]
7475
pub struct Theme {
7576
progress_symbol: String,
7677
success_symbol: String,
@@ -442,7 +443,12 @@ impl UserOutput {
442443
/// ```
443444
pub fn progress(&mut self, message: &str) {
444445
if self.verbosity_filter.should_show_progress() {
445-
writeln!(self.stderr_writer, "{} {message}", self.theme.progress_symbol()).ok();
446+
writeln!(
447+
self.stderr_writer,
448+
"{} {message}",
449+
self.theme.progress_symbol()
450+
)
451+
.ok();
446452
}
447453
}
448454

@@ -461,7 +467,12 @@ impl UserOutput {
461467
/// ```
462468
pub fn success(&mut self, message: &str) {
463469
if self.verbosity_filter.should_show_success() {
464-
writeln!(self.stderr_writer, "{} {message}", self.theme.success_symbol()).ok();
470+
writeln!(
471+
self.stderr_writer,
472+
"{} {message}",
473+
self.theme.success_symbol()
474+
)
475+
.ok();
465476
}
466477
}
467478

@@ -478,7 +489,12 @@ impl UserOutput {
478489
/// ```
479490
pub fn warn(&mut self, message: &str) {
480491
if self.verbosity_filter.should_show_warnings() {
481-
writeln!(self.stderr_writer, "{} {message}", self.theme.warning_symbol()).ok();
492+
writeln!(
493+
self.stderr_writer,
494+
"{} {message}",
495+
self.theme.warning_symbol()
496+
)
497+
.ok();
482498
}
483499
}
484500

@@ -497,7 +513,12 @@ impl UserOutput {
497513
/// ```
498514
pub fn error(&mut self, message: &str) {
499515
if self.verbosity_filter.should_show_errors() {
500-
writeln!(self.stderr_writer, "{} {message}", self.theme.error_symbol()).ok();
516+
writeln!(
517+
self.stderr_writer,
518+
"{} {message}",
519+
self.theme.error_symbol()
520+
)
521+
.ok();
501522
}
502523
}
503524

@@ -705,7 +726,8 @@ pub mod test_support {
705726
let stdout_writer = Box::new(TestWriter::new(Arc::clone(&stdout_buffer)));
706727
let stderr_writer = Box::new(TestWriter::new(Arc::clone(&stderr_buffer)));
707728

708-
let output = UserOutput::with_theme_and_writers(verbosity, theme, stdout_writer, stderr_writer);
729+
let output =
730+
UserOutput::with_theme_and_writers(verbosity, theme, stdout_writer, stderr_writer);
709731

710732
Self {
711733
output,
@@ -912,7 +934,7 @@ mod tests {
912934
#[test]
913935
fn it_should_support_debug_formatting() {
914936
let theme = Theme::emoji();
915-
let debug_output = format!("{:?}", theme);
937+
let debug_output = format!("{theme:?}");
916938

917939
assert!(debug_output.contains("Theme"));
918940
}
@@ -1293,7 +1315,8 @@ mod tests {
12931315

12941316
#[test]
12951317
fn it_should_use_plain_theme_when_specified() {
1296-
let mut test_output = TestUserOutput::with_theme(VerbosityLevel::Normal, Theme::plain());
1318+
let mut test_output =
1319+
TestUserOutput::with_theme(VerbosityLevel::Normal, Theme::plain());
12971320

12981321
test_output.output.progress("Test");
12991322
test_output.output.success("Success");
@@ -1309,7 +1332,8 @@ mod tests {
13091332

13101333
#[test]
13111334
fn it_should_use_ascii_theme_when_specified() {
1312-
let mut test_output = TestUserOutput::with_theme(VerbosityLevel::Normal, Theme::ascii());
1335+
let mut test_output =
1336+
TestUserOutput::with_theme(VerbosityLevel::Normal, Theme::ascii());
13131337

13141338
test_output.output.progress("Test");
13151339
test_output.output.success("Success");

0 commit comments

Comments
 (0)