From 35159b8393d51a326caf959cb6fb4ed47b217534 Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Mon, 11 Nov 2024 08:00:03 +0530 Subject: [PATCH] Reference instead of passing the vector --- tui/src/confirmation.rs | 2 +- tui/src/state.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tui/src/confirmation.rs b/tui/src/confirmation.rs index 64b160e0..1993c3f5 100644 --- a/tui/src/confirmation.rs +++ b/tui/src/confirmation.rs @@ -21,7 +21,7 @@ pub struct ConfirmPrompt { } impl ConfirmPrompt { - pub fn new(names: Vec<&str>) -> Self { + pub fn new(names: &[&str]) -> Self { let names = names .iter() .zip(1..) diff --git a/tui/src/state.rs b/tui/src/state.rs index ed320a2d..396123a9 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -137,7 +137,7 @@ impl AppState { .map(|node| node.name.as_str()) .collect(); - let prompt = ConfirmPrompt::new(cmd_names); + let prompt = ConfirmPrompt::new(&cmd_names); self.focus = Focus::ConfirmationPrompt(Float::new(Box::new(prompt), 40, 40)); } } @@ -798,7 +798,7 @@ impl AppState { .map(|node| node.name.as_str()) .collect::>(); - let prompt = ConfirmPrompt::new(cmd_names); + let prompt = ConfirmPrompt::new(&cmd_names); self.focus = Focus::ConfirmationPrompt(Float::new(Box::new(prompt), 40, 40)); } }