Skip to content

Commit 116539b

Browse files
committed
Fix clippy, fmt & MerkleTree
1 parent 754c98b commit 116539b

File tree

6 files changed

+8
-10
lines changed

6 files changed

+8
-10
lines changed

adapter/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,12 @@ mod test {
230230
.expect("The timestamp should be able to be converted to u64");
231231
BigEndian::write_uint(&mut timestamp_buf[26..], n, 6);
232232

233-
let merkle_tree = MerkleTree::new(&[timestamp_buf]);
233+
let merkle_tree = MerkleTree::new(&[timestamp_buf]).expect("Should instantiate");
234234

235235
let channel_id = "061d5e2a67d0a9a10f1c732bca12a676d83f79663a396f7d87b3e30b9b411088";
236236

237237
let state_root = get_signable_state_root(
238-
&hex::decode(&channel_id).expect("fialed"),
238+
&hex::decode(&channel_id).expect("failed"),
239239
&merkle_tree.root(),
240240
)
241241
.expect("Should get state_root");

primitives/src/merkle_tree.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use merkletree::{hash::Algorithm, merkle, merkle::VecStore, proof::Proof};
2+
use std::fmt;
23
use std::hash::Hasher;
34
use std::iter::FromIterator;
4-
use tiny_keccak::Keccak;
55
use thiserror::Error;
6-
use std::fmt;
6+
use tiny_keccak::Keccak;
77

88
#[derive(Clone)]
99
struct KeccakAlgorithm(Keccak);

sentry/src/db.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub async fn postgres_connection() -> Result<DbPool, bb8_postgres::tokio_postgre
4646
.user(POSTGRES_USER.as_str())
4747
.password(POSTGRES_PASSWORD.as_str())
4848
.host(POSTGRES_HOST.as_str())
49-
.port(POSTGRES_PORT.clone());
49+
.port(*POSTGRES_PORT);
5050
if let Some(db) = POSTGRES_DB.clone() {
5151
config.dbname(&db);
5252
}
@@ -62,7 +62,7 @@ pub async fn setup_migrations(environment: &str) {
6262
.database_user(POSTGRES_USER.as_str())
6363
.database_password(POSTGRES_PASSWORD.as_str())
6464
.database_host(POSTGRES_HOST.as_str())
65-
.database_port(POSTGRES_PORT.clone())
65+
.database_port(*POSTGRES_PORT)
6666
.database_name(&POSTGRES_DB.as_ref().unwrap_or(&POSTGRES_USER))
6767
.build()
6868
.expect("Should build migration settings");

sentry/src/event_aggregator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ async fn store(db: &DbPool, channel_id: &ChannelId, logger: &Logger, recorder: R
5858
aggregate: new_aggr(&channel_id),
5959
};
6060
channel_recorder.insert(channel_id.to_owned(), record);
61-
};
61+
}
6262
}
6363
}
6464

sentry/src/event_reducer.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ use crate::analytics_recorder::get_payout;
22
use primitives::sentry::{AggregateEvents, Event, EventAggregate};
33
use primitives::{BigNum, Channel, ValidatorId};
44

5-
// @TODO: Remove attribute once we use this function!
6-
#[allow(dead_code)]
75
pub(crate) fn reduce(channel: &Channel, initial_aggr: &mut EventAggregate, ev: &Event) {
86
match ev {
97
Event::Impression { publisher, .. } => {

sentry/src/middleware/auth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn get_request_ip(req: &Request<Body>) -> Option<String> {
7777
.get("true-client-ip")
7878
.or_else(|| req.headers().get("x-forwarded-for"))
7979
.and_then(|hv| hv.to_str().map(ToString::to_string).ok())
80-
.map(|token| token.split(',').nth(0).map(ToString::to_string))
80+
.map(|token| token.split(',').next().map(ToString::to_string))
8181
.flatten()
8282
}
8383

0 commit comments

Comments
 (0)