From 2962049926c148570699238652458a610b429fac Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 14 Jan 2025 05:03:17 +0200 Subject: [PATCH] remove extra clone, use references --- src/app/browser/window/tab/item/page.rs | 12 +++--------- src/app/browser/window/tab/item/page/input.rs | 2 +- src/app/browser/window/tab/item/page/input/titan.rs | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/app/browser/window/tab/item/page.rs b/src/app/browser/window/tab/item/page.rs index 14b72352..31636abd 100644 --- a/src/app/browser/window/tab/item/page.rs +++ b/src/app/browser/window/tab/item/page.rs @@ -237,11 +237,8 @@ impl Page { let title = gformat!("Titan input"); // Toggle input form - self.input.set_new_titan( - self.tab_action.clone(), - uri.clone(), - Some(&title), - ); + self.input + .set_new_titan(&self.tab_action, &uri, Some(&title)); // Update meta self.meta.set_status(status).set_title(&title); @@ -443,10 +440,7 @@ impl Page { // Begin new socket request self.client.gemini.request_async( - match uri.scheme().as_str() { - "titan" => Request::titan(uri.clone(), Vec::new(), None, None), // @TODO - _ => Request::gemini(uri.clone()) - }, + Request::gemini(uri.clone()), Priority::DEFAULT, cancellable.clone(), // Search for user certificate match request diff --git a/src/app/browser/window/tab/item/page/input.rs b/src/app/browser/window/tab/item/page/input.rs index e82982a9..f10b3af9 100644 --- a/src/app/browser/window/tab/item/page/input.rs +++ b/src/app/browser/window/tab/item/page/input.rs @@ -66,7 +66,7 @@ impl Input { )); } - pub fn set_new_titan(&self, action: Rc, base: Uri, title: Option<&str>) { + pub fn set_new_titan(&self, action: &Rc, base: &Uri, title: Option<&str>) { self.widget .update(Some(&Titan::build(action, base, title).widget.g_box)); } diff --git a/src/app/browser/window/tab/item/page/input/titan.rs b/src/app/browser/window/tab/item/page/input/titan.rs index 0f252d2a..69b759b7 100644 --- a/src/app/browser/window/tab/item/page/input/titan.rs +++ b/src/app/browser/window/tab/item/page/input/titan.rs @@ -24,7 +24,7 @@ impl Titan { // Constructors /// Build new `Self` - pub fn build(_tab_action: Rc, _base: Uri, title: Option<&str>) -> Self { + pub fn build(_tab_action: &Rc, _base: &Uri, title: Option<&str>) -> Self { // Init local actions let action_update = SimpleAction::new(&uuid_string_random(), None); let action_send = SimpleAction::new(&uuid_string_random(), None);