From 9dad6596651df282e70206082ea97b3f48ab89f1 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Wed, 7 Aug 2024 15:19:35 +0200 Subject: [PATCH] chore(components/config): cleanup code (#2592) Cleanup code by using `Option::is_some_and()` and `Option::as_deref()` instead of recoding them. --- components/config/src/config/taxonomies.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/components/config/src/config/taxonomies.rs b/components/config/src/config/taxonomies.rs index 6638471dac..46842b5d6b 100644 --- a/components/config/src/config/taxonomies.rs +++ b/components/config/src/config/taxonomies.rs @@ -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") } }