From 459016e70dd4933a8082d27748097de81a3e53ff Mon Sep 17 00:00:00 2001 From: Joris Date: Mon, 17 Apr 2023 21:10:48 +0200 Subject: Follow clippy indications --- src/queries.rs | 58 ++++++++++++++++++++-------------------------------------- 1 file changed, 20 insertions(+), 38 deletions(-) (limited to 'src/queries.rs') diff --git a/src/queries.rs b/src/queries.rs index db098e7..8ecc4fe 100644 --- a/src/queries.rs +++ b/src/queries.rs @@ -22,62 +22,44 @@ pub fn payments_url(q: Payments) -> String { Some(p) => params.push(format!("page={}", p)), }; - match q.frequency { - Some(Frequency::Monthly) => { - params.push("frequency=Monthly".to_string()) - } - _ => (), + if let Some(Frequency::Monthly) = q.frequency { + params.push("frequency=Monthly".to_string()) }; - match q.highlight { - Some(id) => params.push(format!("highlight={}", id)), - _ => (), + if let Some(id) = q.highlight { + params.push(format!("highlight={}", id)) }; - match q.name { - Some(str) => { - if !str.is_empty() { - params.push(format!("name={}", str)) - } + if let Some(str) = q.name { + if !str.is_empty() { + params.push(format!("name={}", str)) } - _ => (), }; - match q.cost { - Some(str) => { - if !str.is_empty() { - params.push(format!("cost={}", str)) - } + if let Some(str) = q.cost { + if !str.is_empty() { + params.push(format!("cost={}", str)) } - _ => (), }; - match q.user { - Some(id) => params.push(format!("user={}", id)), - _ => (), + if let Some(id) = q.user { + params.push(format!("user={}", id)) }; - match q.category { - Some(id) => params.push(format!("category={}", id)), - _ => (), + if let Some(id) = q.category { + params.push(format!("category={}", id)) }; - match q.start_date { - Some(str) => { - if !str.is_empty() { - params.push(format!("start_date={}", str)) - } + if let Some(str) = q.start_date { + if !str.is_empty() { + params.push(format!("start_date={}", str)) } - _ => (), }; - match q.end_date { - Some(str) => { - if !str.is_empty() { - params.push(format!("end_date={}", str)) - } + if let Some(str) = q.end_date { + if !str.is_empty() { + params.push(format!("end_date={}", str)) } - _ => (), }; if params.is_empty() { -- cgit v1.2.3