Skip to content
This repository was archived by the owner on Aug 1, 2022. It is now read-only.

Commit 94e52a6

Browse files
committed
Appease clippy
1 parent 5c62e77 commit 94e52a6

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

proxy/src/http/transaction.rs

+13-8
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ impl ToDocumentedType for ListInput {
207207
}
208208
}
209209

210-
#[allow(clippy::result_unwrap_used)]
211210
#[cfg(test)]
212211
mod test {
213212
use std::convert::TryFrom;
@@ -223,20 +222,22 @@ mod test {
223222

224223
#[tokio::test]
225224
async fn list() {
226-
let tmp_dir = tempfile::tempdir().unwrap();
225+
let tmp_dir = tempfile::tempdir().expect("tmp dir creation failed");
227226
let registry = {
228227
let (client, _) = radicle_registry_client::Client::new_emulator();
229228
registry::Registry::new(client)
230229
};
231-
let store = kv::Store::new(kv::Config::new(tmp_dir.path().join("store"))).unwrap();
230+
let store = kv::Store::new(kv::Config::new(tmp_dir.path().join("store")))
231+
.expect("Store creation failed");
232232
let cache = registry::Cacher::new(registry, &store);
233233
let now = registry::Timestamp::now();
234234

235235
let tx = registry::Transaction {
236236
id: registry::Hash(radicle_registry_client::TxHash::random()),
237237
messages: vec![registry::Message::ProjectRegistration {
238-
project_name: registry::ProjectName::try_from("upstream").unwrap(),
239-
org_id: registry::Id::try_from("radicle").unwrap(),
238+
project_name: registry::ProjectName::try_from("upstream")
239+
.expect("String conversion failed"),
240+
org_id: registry::Id::try_from("radicle").expect("String conversion failed"),
240241
}],
241242
state: registry::State::Confirmed {
242243
block: 1,
@@ -247,9 +248,13 @@ mod test {
247248
timestamp: now,
248249
};
249250

250-
cache.cache_transaction(tx.clone()).unwrap();
251+
cache
252+
.cache_transaction(tx.clone())
253+
.expect("Caching transaction failed");
251254

252-
let transactions = cache.list_transactions(vec![]).unwrap();
255+
let transactions = cache
256+
.list_transactions(vec![])
257+
.expect("Listing transactions failed");
253258

254259
let api = super::filters(Arc::new(RwLock::new(cache)));
255260
let res = request()
@@ -259,7 +264,7 @@ mod test {
259264
.reply(&api)
260265
.await;
261266

262-
let have: Value = serde_json::from_slice(res.body()).unwrap();
267+
let have: Value = serde_json::from_slice(res.body()).expect("Serialization to JSON failed");
263268

264269
assert_eq!(res.status(), StatusCode::OK);
265270
assert_eq!(have, json!(transactions));

proxy/src/registry/transaction.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::integer_arithmetic)]
12
//! Abstractions and types to handle, persist and interact with transactions.
23
34
use async_trait::async_trait;

0 commit comments

Comments
 (0)