Use cow for xlookup

This commit is contained in:
Austen Adler 2022-10-02 10:46:51 -04:00
parent d897fdea87
commit 093689c02b

View File

@ -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<String, KakError> {
|| {
eprintln!("Key '{key}' not found",);
err_count += 1;
String::from("")
Cow::Borrowed("")
},
ToString::to_string,
|s| Cow::Owned(ToString::to_string(s)),
)
}))?;