refactor: clippy::if_not_else (#974)

This commit is contained in:
EdJoPaTo 2024-03-02 13:05:15 +01:00 committed by Josh McKinney
parent 5ed1f43c62
commit 14b24e7585
No known key found for this signature in database
GPG key ID: 722287396A903BC5
2 changed files with 7 additions and 6 deletions

View file

@ -73,6 +73,7 @@ doc_markdown = "warn"
empty_line_after_doc_comments = "warn"
equatable_if_let = "warn"
explicit_iter_loop = "warn"
if_not_else = "warn"
implicit_clone = "warn"
inefficient_to_string = "warn"
items_after_statements = "warn"

View file

@ -99,7 +99,12 @@ impl<'a, DS: DateStyler> Monthly<'a, DS> {
/// All logic to style a date goes here.
fn format_date(&self, date: Date) -> Span {
if date.month() != self.display_date.month() {
if date.month() == self.display_date.month() {
Span::styled(
format!("{:2?}", date.day()),
self.default_style.patch(self.events.get_style(date)),
)
} else {
match self.show_surrounding {
None => Span::styled(" ", self.default_bg()),
Some(s) => {
@ -110,11 +115,6 @@ impl<'a, DS: DateStyler> Monthly<'a, DS> {
Span::styled(format!("{:2?}", date.day()), style)
}
}
} else {
Span::styled(
format!("{:2?}", date.day()),
self.default_style.patch(self.events.get_style(date)),
)
}
}
}