[librsvg: 22/23] Clippy - coalesce ifs with same bodies
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 22/23] Clippy - coalesce ifs with same bodies
- Date: Mon, 24 May 2021 17:47:34 +0000 (UTC)
commit 2567c6d04c100705d43eea4db23fabf5afe2dc50
Author: Federico Mena Quintero <federico gnome org>
Date: Fri May 21 20:13:37 2021 -0500
Clippy - coalesce ifs with same bodies
src/accept_language.rs | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/src/accept_language.rs b/src/accept_language.rs
index bdf95e3b..134c9d04 100644
--- a/src/accept_language.rs
+++ b/src/accept_language.rs
@@ -133,14 +133,12 @@ impl Item {
let first_digit = qvalue.chars().next().unwrap();
if let Some(decimals) = qvalue[1..].strip_prefix(".") {
- if first_digit == '0'
+ if (first_digit == '0'
&& decimals.len() <= 3
- && decimals.chars().all(|c| c.is_digit(10))
- {
- qvalue
- } else if first_digit == '1'
- && decimals.len() <= 3
- && decimals.chars().all(|c| c == '0')
+ && decimals.chars().all(|c| c.is_digit(10)))
+ || (first_digit == '1'
+ && decimals.len() <= 3
+ && decimals.chars().all(|c| c == '0'))
{
qvalue
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]