Skip to content

Commit 2c127af

Browse files
committed
utils: Pass borrowed attributes
1 parent 1f43d0f commit 2c127af

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

cli/src/main.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,28 +109,28 @@ async fn main() -> Result<(), Error> {
109109
StoreArgs::from_arg_matches(matches).map_err(|e| Error::new(&e.to_string()))?;
110110
let attributes = parse_attributes(&args.attributes)?;
111111

112-
store(&args.label, attributes).await
112+
store(&args.label, &attributes).await
113113
}
114114
Some(("lookup", matches)) => {
115115
let args =
116116
LookupArgs::from_arg_matches(matches).map_err(|e| Error::new(&e.to_string()))?;
117117
let attributes = parse_attributes(&args.attributes)?;
118118

119-
lookup(attributes).await
119+
lookup(&attributes).await
120120
}
121121
Some(("search", matches)) => {
122122
let args =
123123
SearchArgs::from_arg_matches(matches).map_err(|e| Error::new(&e.to_string()))?;
124124
let attributes = parse_attributes(&args.attributes)?;
125125

126-
search(attributes, args.all).await
126+
search(&attributes, args.all).await
127127
}
128128
Some(("delete", matches)) => {
129129
let args =
130130
LookupArgs::from_arg_matches(matches).map_err(|e| Error::new(&e.to_string()))?;
131131
let attributes = parse_attributes(&args.attributes)?;
132132

133-
delete(attributes).await
133+
delete(&attributes).await
134134
}
135135
Some(("lock", _matches)) => lock().await,
136136
Some(("unlock", _matches)) => unlock().await,
@@ -158,7 +158,7 @@ fn parse_attributes(attributes: &[String]) -> Result<HashMap<&str, &str>, Error>
158158
}
159159
}
160160

161-
async fn store(label: &str, attributes: HashMap<&str, &str>) -> Result<(), Error> {
161+
async fn store(label: &str, attributes: &HashMap<&str, &str>) -> Result<(), Error> {
162162
let collection = collection().await?;
163163

164164
print!("Type a secret: ");
@@ -174,7 +174,7 @@ async fn store(label: &str, attributes: HashMap<&str, &str>) -> Result<(), Error
174174
Ok(())
175175
}
176176

177-
async fn lookup(attributes: HashMap<&str, &str>) -> Result<(), Error> {
177+
async fn lookup(attributes: &HashMap<&str, &str>) -> Result<(), Error> {
178178
let collection = collection().await?;
179179
let items = collection.search_items(attributes).await?;
180180

@@ -188,7 +188,7 @@ async fn lookup(attributes: HashMap<&str, &str>) -> Result<(), Error> {
188188
Ok(())
189189
}
190190

191-
async fn search(attributes: HashMap<&str, &str>, all: bool) -> Result<(), Error> {
191+
async fn search(attributes: &HashMap<&str, &str>, all: bool) -> Result<(), Error> {
192192
let collection = collection().await?;
193193
let items = collection.search_items(attributes).await?;
194194

@@ -203,7 +203,7 @@ async fn search(attributes: HashMap<&str, &str>, all: bool) -> Result<(), Error>
203203
Ok(())
204204
}
205205

206-
async fn delete(attributes: HashMap<&str, &str>) -> Result<(), Error> {
206+
async fn delete(attributes: &HashMap<&str, &str>) -> Result<(), Error> {
207207
let collection = collection().await?;
208208
let items = collection.search_items(attributes).await?;
209209

0 commit comments

Comments
 (0)