File tree Expand file tree Collapse file tree 3 files changed +2
-16
lines changed Expand file tree Collapse file tree 3 files changed +2
-16
lines changed Original file line number Diff line number Diff line change 1
1
pub mod tests {
2
- use rand:: seq:: SliceRandom ;
3
- use rand:: thread_rng;
4
-
5
2
pub mod prep_db;
6
3
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
- }
13
4
}
14
5
15
6
pub mod serde {
Original file line number Diff line number Diff line change @@ -65,9 +65,7 @@ impl TryFrom<&str> for ValidatorId {
65
65
impl TryFrom < & String > for ValidatorId {
66
66
type Error = DomainError ;
67
67
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 ( ) )
71
69
}
72
70
}
73
71
Original file line number Diff line number Diff line change @@ -107,11 +107,8 @@ impl<T: Adapter + 'static> SentryApi<T> {
107
107
. and_then ( |mut res : Response | res. json :: < ValidatorMessageResponse > ( ) )
108
108
. compat ( )
109
109
. await ?;
110
- if !result. validator_messages . is_empty ( ) {
111
- return Ok ( Some ( result. validator_messages [ 0 ] . msg . clone ( ) ) ) ;
112
- }
113
110
114
- Ok ( None )
111
+ Ok ( result . validator_messages . first ( ) . map ( |m| m . msg . clone ( ) ) )
115
112
}
116
113
117
114
pub async fn get_our_latest_msg (
You can’t perform that action at this time.
0 commit comments