Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
devmatteini authored and djc committed Nov 6, 2022
1 parent 5b8b905 commit 8e220fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl TermLike for InMemoryTerm {
.state
.lock()
.unwrap()
.write_str(&*format!("\x1b[{}A", n)),
.write_str(&format!("\x1b[{}A", n)),
}
}

Expand All @@ -78,7 +78,7 @@ impl TermLike for InMemoryTerm {
.state
.lock()
.unwrap()
.write_str(&*format!("\x1b[{}B", n)),
.write_str(&format!("\x1b[{}B", n)),
}
}

Expand All @@ -89,7 +89,7 @@ impl TermLike for InMemoryTerm {
.state
.lock()
.unwrap()
.write_str(&*format!("\x1b[{}C", n)),
.write_str(&format!("\x1b[{}C", n)),
}
}

Expand All @@ -100,7 +100,7 @@ impl TermLike for InMemoryTerm {
.state
.lock()
.unwrap()
.write_str(&*format!("\x1b[{}D", n)),
.write_str(&format!("\x1b[{}D", n)),
}
}

Expand Down
8 changes: 2 additions & 6 deletions src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,7 @@ impl ProgressStyle {
let entirely_filled = fill as usize;
// 1 if the bar is not entirely empty or full (meaning we need to draw the "current"
// character between the filled and "to do" segment), 0 otherwise.
let head = if fill > 0.0 && entirely_filled < width {
1
} else {
0
};
let head = usize::from(fill > 0.0 && entirely_filled < width);

let cur = if head == 1 {
// Number of fine-grained progress entries in progress_chars.
Expand Down Expand Up @@ -423,7 +419,7 @@ impl<'a> WideElement<'a> {
buf: &mut String,
width: u16,
) -> String {
let left = (width as usize).saturating_sub(measure_text_width(&*cur.replace('\x00', "")));
let left = (width as usize).saturating_sub(measure_text_width(&cur.replace('\x00', "")));
match self {
Self::Bar { alt_style } => cur.replace(
'\x00',
Expand Down

0 comments on commit 8e220fd

Please sign in to comment.