Browse Source
Prefer `.parse` over `FromStr` to avoid an import
refactor/no-log-handler
Thomas Eizinger
3 years ago
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96
1 changed files with
5 additions and
3 deletions
-
daemon/src/model.rs
|
|
@ -5,7 +5,6 @@ use rust_decimal::prelude::ToPrimitive; |
|
|
|
use rust_decimal::Decimal; |
|
|
|
use serde::{Deserialize, Serialize}; |
|
|
|
use std::fmt; |
|
|
|
use std::str::FromStr; |
|
|
|
use std::time::SystemTime; |
|
|
|
use uuid::Uuid; |
|
|
|
|
|
|
@ -111,7 +110,8 @@ pub struct BitMexPriceEventId(pub String); |
|
|
|
|
|
|
|
impl BitMexPriceEventId { |
|
|
|
pub fn to_olivia_url(&self) -> Url { |
|
|
|
Url::from_str("https://h00.ooo") |
|
|
|
"https://h00.ooo" |
|
|
|
.parse::<Url>() |
|
|
|
.expect("valid URL from constant") |
|
|
|
.join(self.0.as_str()) |
|
|
|
.expect("Event id can be joined") |
|
|
@ -135,7 +135,9 @@ mod tests { |
|
|
|
|
|
|
|
assert_eq!( |
|
|
|
url, |
|
|
|
Url::from_str("https://h00.ooo/x/BitMEX/BXBT/2021-09-23T10:00:00.price?n=20").unwrap() |
|
|
|
"https://h00.ooo/x/BitMEX/BXBT/2021-09-23T10:00:00.price?n=20" |
|
|
|
.parse() |
|
|
|
.unwrap() |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|