summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohamed Abdelnour <mohamed.k.abdelnour@gmail.com>2021-05-21 15:47:27 +0200
committerDavid Peter <sharkdp@users.noreply.github.com>2021-05-27 12:05:07 +0200
commit425a0f90e9ee2734693dae523369873e53dc553c (patch)
tree4660372059c125f4c6cfc0740dc499558add8b41
parenta27814db8e651100bd718efb34b2dc6a034973ea (diff)
Use the functional update syntax
-rw-r--r--src/printer.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/printer.rs b/src/printer.rs
index 45caf157..11db9563 100644
--- a/src/printer.rs
+++ b/src/printer.rs
@@ -447,8 +447,10 @@ impl<'a> Printer for InteractivePrinter<'a> {
if text.len() != text_trimmed.len() {
if let Some(background_color) = background_color {
- let mut ansi_style = Style::default();
- ansi_style.background = to_ansi_color(background_color, true_color);
+ let ansi_style = Style {
+ background: to_ansi_color(background_color, true_color),
+ ..Default::default()
+ };
let width = if cursor_total <= cursor_max {
cursor_max - cursor_total + 1
} else {
@@ -588,8 +590,10 @@ impl<'a> Printer for InteractivePrinter<'a> {
}
if let Some(background_color) = background_color {
- let mut ansi_style = Style::default();
- ansi_style.background = to_ansi_color(background_color, self.config.true_color);
+ let ansi_style = Style {
+ background: to_ansi_color(background_color, self.config.true_color),
+ ..Default::default()
+ };
write!(
handle,