From 093689c02b857d1156c0b5d36e8434d45aa671ce Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sun, 2 Oct 2022 10:46:51 -0400 Subject: [PATCH] Use cow for xlookup --- src/xlookup.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/xlookup.rs b/src/xlookup.rs index 6e9c095..9538ac5 100644 --- a/src/xlookup.rs +++ b/src/xlookup.rs @@ -5,6 +5,7 @@ use kakplugin::{ Selection, }; use std::{ + borrow::Cow, collections::{ btree_map::Entry::{Occupied, Vacant}, hash_map::DefaultHasher, @@ -33,9 +34,9 @@ pub fn xlookup(options: &Options) -> Result { || { eprintln!("Key '{key}' not found",); err_count += 1; - String::from("") + Cow::Borrowed("") }, - ToString::to_string, + |s| Cow::Owned(ToString::to_string(s)), ) }))?;