From 6702f9c7d6e88524ab02f309a45766c951a5e836 Mon Sep 17 00:00:00 2001 From: yggverse Date: Fri, 8 Nov 2024 05:45:15 +0200 Subject: [PATCH] enshort constructions --- .../browser/window/tab/item/page/input/response.rs | 14 +++++--------- .../window/tab/item/page/input/sensitive.rs | 8 ++------ 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/app/browser/window/tab/item/page/input/response.rs b/src/app/browser/window/tab/item/page/input/response.rs index 9c54591e..5d39e25a 100644 --- a/src/app/browser/window/tab/item/page/input/response.rs +++ b/src/app/browser/window/tab/item/page/input/response.rs @@ -47,15 +47,11 @@ impl Response { let control = control.clone(); let form = form.clone(); move |_, _| { - control.update(match size_limit { - Some(limit) => Some( - limit as i32 - - (base.to_string_partial(UriHideFlags::QUERY).len() as i32 - + Uri::escape_string(form.text().as_str(), None, false).len() - as i32), - ), - None => None, - }); + control.update(size_limit.map(|limit| { + limit as i32 + - (base.to_string_partial(UriHideFlags::QUERY).len() as i32 + + Uri::escape_string(form.text().as_str(), None, false).len() as i32) + })); } }); diff --git a/src/app/browser/window/tab/item/page/input/sensitive.rs b/src/app/browser/window/tab/item/page/input/sensitive.rs index edfeced1..60a7bfbe 100644 --- a/src/app/browser/window/tab/item/page/input/sensitive.rs +++ b/src/app/browser/window/tab/item/page/input/sensitive.rs @@ -32,12 +32,8 @@ impl Sensitive { let form = Form::new_rc( action_send.clone(), title, - match max_length { - Some(value) => { - Some(value - base.to_string_partial(UriHideFlags::QUERY).len() as i32) - } - None => None, - }, + max_length + .map(|value| value - base.to_string_partial(UriHideFlags::QUERY).len() as i32), ); // Init widget