Skip to content

Commit 138e676

Browse files
committed
utils: Pass borrowed attributes
1 parent 44e3e55 commit 138e676

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
@@ -107,28 +107,28 @@ async fn main() -> Result<(), Error> {
107107
StoreArgs::from_arg_matches(matches).map_err(|e| Error::new(&e.to_string()))?;
108108
let attributes = parse_attributes(&args.attributes)?;
109109

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

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

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

131-
delete(attributes).await
131+
delete(&attributes).await
132132
}
133133
Some(("lock", _matches)) => lock().await,
134134
Some(("unlock", _matches)) => unlock().await,
@@ -156,7 +156,7 @@ fn parse_attributes(attributes: &[String]) -> Result<HashMap<&str, &str>, Error>
156156
}
157157
}
158158

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

162162
print!("Type a secret: ");
@@ -172,7 +172,7 @@ async fn store(label: &str, attributes: HashMap<&str, &str>) -> Result<(), Error
172172
Ok(())
173173
}
174174

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

@@ -186,7 +186,7 @@ async fn lookup(attributes: HashMap<&str, &str>) -> Result<(), Error> {
186186
Ok(())
187187
}
188188

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

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

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

0 commit comments

Comments
 (0)