refactor: shorten a match expression

Signed-off-by: ljedrz <ljedrz@gmail.com>
This commit is contained in:
ljedrz 2020-06-29 12:41:29 +02:00
parent 8c92c34d44
commit 1c299109d2

View File

@ -163,19 +163,10 @@ async fn rm_query<T: IpfsTypes>(
hash: cid.to_string(),
error: "".to_string(),
},
Err((cid, e)) => {
if force {
RmResponse {
hash: cid.to_string(),
error: "".to_string(),
}
} else {
RmResponse {
hash: cid.to_string(),
error: e.to_string(),
}
}
}
Err((cid, e)) => RmResponse {
hash: cid.to_string(),
error: if force { "".to_string() } else { e.to_string() },
},
})
.map(|response: RmResponse| serde_json::to_string(&response))
.map(move |result| match result {