Skip to content

Commit

Permalink
chore(components/config): cleanup code (#2592)
Browse files Browse the repository at this point in the history
Cleanup code by using `Option::is_some_and()` and
`Option::as_deref()` instead of recoding them.
  • Loading branch information
samueltardieu committed Aug 7, 2024
1 parent 88bd972 commit 4fa15ee
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions components/config/src/config/taxonomies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

0 comments on commit 4fa15ee

Please sign in to comment.