refactor: clippy::match_same_arms (#974)

This commit is contained in:
EdJoPaTo 2024-03-02 13:15:44 +01:00 committed by Josh McKinney
parent a4e84a6a7f
commit 060d26b6dc
No known key found for this signature in database
GPG key ID: 722287396A903BC5
3 changed files with 3 additions and 4 deletions

View file

@ -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"

View file

@ -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),
}

View file

@ -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 {