Use cow for xlookup
This commit is contained in:
parent
d897fdea87
commit
093689c02b
@ -5,6 +5,7 @@ use kakplugin::{
|
|||||||
Selection,
|
Selection,
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
|
borrow::Cow,
|
||||||
collections::{
|
collections::{
|
||||||
btree_map::Entry::{Occupied, Vacant},
|
btree_map::Entry::{Occupied, Vacant},
|
||||||
hash_map::DefaultHasher,
|
hash_map::DefaultHasher,
|
||||||
@ -33,9 +34,9 @@ pub fn xlookup(options: &Options) -> Result<String, KakError> {
|
|||||||
|| {
|
|| {
|
||||||
eprintln!("Key '{key}' not found",);
|
eprintln!("Key '{key}' not found",);
|
||||||
err_count += 1;
|
err_count += 1;
|
||||||
String::from("")
|
Cow::Borrowed("")
|
||||||
},
|
},
|
||||||
ToString::to_string,
|
|s| Cow::Owned(ToString::to_string(s)),
|
||||||
)
|
)
|
||||||
}))?;
|
}))?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user