Skip to content

Commit be3a862

Browse files
author
Ivo Georgiev
authored
Merge pull request #171 from AdExNetwork/misc
Various review-related changes
2 parents df55e1a + f197fc3 commit be3a862

File tree

3 files changed

+2
-16
lines changed

3 files changed

+2
-16
lines changed

primitives/src/util.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
pub mod tests {
2-
use rand::seq::SliceRandom;
3-
use rand::thread_rng;
4-
52
pub mod prep_db;
63
pub mod time;
7-
8-
#[inline]
9-
pub fn take_one<'a, T: ?Sized>(list: &[&'a T]) -> &'a T {
10-
let mut rng = thread_rng();
11-
list.choose(&mut rng).expect("take_one got empty list")
12-
}
134
}
145

156
pub mod serde {

primitives/src/validator.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ impl TryFrom<&str> for ValidatorId {
6565
impl TryFrom<&String> for ValidatorId {
6666
type Error = DomainError;
6767
fn try_from(value: &String) -> Result<Self, Self::Error> {
68-
ValidatorId::try_from(value.as_str()).map_err(|_| {
69-
DomainError::InvalidArgument("Failed to deserialize validator id".to_string())
70-
})
68+
ValidatorId::try_from(value.as_str())
7169
}
7270
}
7371

validator_worker/src/sentry_interface.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,8 @@ impl<T: Adapter + 'static> SentryApi<T> {
107107
.and_then(|mut res: Response| res.json::<ValidatorMessageResponse>())
108108
.compat()
109109
.await?;
110-
if !result.validator_messages.is_empty() {
111-
return Ok(Some(result.validator_messages[0].msg.clone()));
112-
}
113110

114-
Ok(None)
111+
Ok(result.validator_messages.first().map(|m| m.msg.clone()))
115112
}
116113

117114
pub async fn get_our_latest_msg(

0 commit comments

Comments
 (0)