From 0f254ee5413e06fb8f4e016ef39db7dd43f055c1 Mon Sep 17 00:00:00 2001 From: Nikita Revenco <154856872+NikitaRevenco@users.noreply.github.com> Date: Tue, 17 Dec 2024 21:19:11 +0000 Subject: [PATCH] refactor: do not use unnecessary Span::raw --- helix-term/src/commands.rs | 2 +- helix-term/src/commands/typed.rs | 2 +- helix-term/src/ui/mod.rs | 10 +++++----- helix-term/src/ui/prompt.rs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index d8b494d74dd3..9c71f3e4e79b 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2164,7 +2164,7 @@ fn searcher(cx: &mut Context, direction: Direction) { completions .iter() .filter(|comp| comp.starts_with(input)) - .map(|comp| (0.., Span::raw(comp.clone()))) + .map(|comp| (0.., comp.clone().into())) .collect() }, move |cx, regex, event| { diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index f0da7f5a8134..3d8655727263 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -3178,7 +3178,7 @@ pub(super) fn command_mode(cx: &mut Context) { false, ) .into_iter() - .map(|(name, _)| (0.., Span::raw(name))) + .map(|(name, _)| (0.., name.into())) .collect() } else { // Otherwise, use the command's completer and the last shellword diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index 7ab303ef06b0..f951dee23453 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -291,7 +291,7 @@ pub mod completers { fuzzy_match(input, names, true) .into_iter() - .map(|(name, _)| ((0..), Span::raw(name))) + .map(|(name, _)| ((0..), name.into())) .collect() } @@ -307,7 +307,7 @@ pub mod completers { fuzzy_match(input, names, false) .into_iter() - .map(|(name, _)| ((0..), Span::raw(name))) + .map(|(name, _)| ((0..), name.into())) .collect() } @@ -372,7 +372,7 @@ pub mod completers { fuzzy_match(input, language_ids, false) .into_iter() - .map(|(name, _)| ((0..), Span::raw(name.to_owned()))) + .map(|(name, _)| ((0..), name.to_owned().into())) .collect() } @@ -388,7 +388,7 @@ pub mod completers { fuzzy_match(input, commands, false) .into_iter() - .map(|(name, _)| ((0..), Span::raw(name.to_owned()))) + .map(|(name, _)| ((0..), name.to_owned().into())) .collect() } @@ -545,7 +545,7 @@ pub mod completers { fuzzy_match(input, iter, false) .into_iter() - .map(|(name, _)| ((0..), Span::raw(name))) + .map(|(name, _)| ((0..), name.into())) .collect() } } diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index 277bde37e309..1dca439a21b2 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -663,7 +663,7 @@ impl Component for Prompt { .editor .registers .iter_preview() - .map(|(ch, preview)| (0.., Span::raw(format!("{} {}", ch, &preview)))) + .map(|(ch, preview)| (0.., format!("{} {}", ch, &preview).into())) .collect(); self.next_char_handler = Some(Box::new(|prompt, c, context| { prompt.insert_str(