chore(components/config): cleanup code (#2592)

Cleanup code by using `Option::is_some_and()` and
`Option::as_deref()` instead of recoding them.
This commit is contained in:
Samuel Tardieu 2024-08-07 15:19:35 +02:00 committed by Vincent Prouillet
parent 9594fa8d06
commit 9dad659665

View file

@ -32,18 +32,10 @@ impl Default for TaxonomyConfig {
impl TaxonomyConfig {
pub fn is_paginated(&self) -> bool {
if let Some(paginate_by) = self.paginate_by {
paginate_by > 0
} else {
false
}
self.paginate_by.is_some_and(|paginate_by| paginate_by > 0)
}
pub fn paginate_path(&self) -> &str {
if let Some(ref path) = self.paginate_path {
path
} else {
"page"
}
self.paginate_path.as_deref().unwrap_or("page")
}
}