Skip to content

Commit

Permalink
refactor: clippy::match_same_arms (#974)
Browse files Browse the repository at this point in the history
  • Loading branch information
EdJoPaTo authored and joshka committed Mar 4, 2024
1 parent a4e84a6 commit 060d26b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ if_not_else = "warn"
implicit_clone = "warn"
inefficient_to_string = "warn"
items_after_statements = "warn"
match_same_arms = "warn"
missing_const_for_fn = "warn"
needless_for_each = "warn"
needless_pass_by_value = "warn"
Expand Down
3 changes: 1 addition & 2 deletions src/layout/constraint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,7 @@ impl Constraint {
let length = f32::from(length);
(percentage * length).min(length) as u16
}
Self::Length(l) => length.min(l),
Self::Fill(l) => length.min(l),
Self::Length(l) | Self::Fill(l) => length.min(l),
Self::Max(m) => length.min(m),
Self::Min(m) => length.max(m),
}
Expand Down
3 changes: 1 addition & 2 deletions src/text/line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,9 @@ impl WidgetRef for Line<'_> {
buf.set_style(area, self.style);
let width = self.width() as u16;
let offset = match self.alignment {
Some(Alignment::Left) => 0,
Some(Alignment::Center) => (area.width.saturating_sub(width)) / 2,
Some(Alignment::Right) => area.width.saturating_sub(width),
None => 0,
Some(Alignment::Left) | None => 0,
};
let mut x = area.left().saturating_add(offset);
for span in &self.spans {
Expand Down

0 comments on commit 060d26b

Please sign in to comment.