Skip to content

Commit fef5a9b

Browse files
committed
edition bump and fmt
1 parent 1f15a68 commit fef5a9b

20 files changed

+114
-87
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "pyth-agent"
33
version = "2.12.3"
4-
edition = "2021"
4+
edition = "2024"
55

66
[[bin]]
77
name = "agent"

src/agent/legacy_schedule.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33

44
use {
55
anyhow::{
6-
anyhow,
76
Context,
87
Result,
8+
anyhow,
99
},
1010
chrono::{
11-
naive::NaiveTime,
1211
DateTime,
1312
Datelike,
1413
Duration,
1514
Utc,
1615
Weekday,
16+
naive::NaiveTime,
1717
},
1818
chrono_tz::{
1919
ParseError,

src/agent/market_schedule.rs

Lines changed: 49 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ use {
77
MHKind,
88
},
99
anyhow::{
10-
anyhow,
1110
Result,
11+
anyhow,
1212
},
1313
chrono::{
14-
naive::NaiveTime,
1514
DateTime,
1615
Datelike,
1716
Duration,
1817
Utc,
18+
naive::NaiveTime,
1919
},
2020
chrono_tz::Tz,
2121
std::{
@@ -24,6 +24,8 @@ use {
2424
str::FromStr,
2525
},
2626
winnow::{
27+
ModalResult,
28+
Parser,
2729
combinator::{
2830
alt,
2931
separated,
@@ -34,8 +36,6 @@ use {
3436
take,
3537
take_till,
3638
},
37-
ModalResult,
38-
Parser,
3939
},
4040
};
4141

@@ -454,40 +454,67 @@ mod tests {
454454
let format = "%Y-%m-%d %H:%M";
455455

456456
// Date no match
457-
assert!(market_schedule
458-
.can_publish_at(&NaiveDateTime::parse_from_str("2023-11-20 05:30", format)?.and_utc()));
457+
assert!(
458+
market_schedule.can_publish_at(
459+
&NaiveDateTime::parse_from_str("2023-11-20 05:30", format)?.and_utc()
460+
)
461+
);
459462

460463
// Date match before range
461-
assert!(!market_schedule
462-
.can_publish_at(&NaiveDateTime::parse_from_str("2023-04-22 08:59", format)?.and_utc()));
464+
assert!(
465+
!market_schedule.can_publish_at(
466+
&NaiveDateTime::parse_from_str("2023-04-22 08:59", format)?.and_utc()
467+
)
468+
);
463469

464470
// Date match at start of range
465-
assert!(market_schedule
466-
.can_publish_at(&NaiveDateTime::parse_from_str("2023-04-22 09:00", format)?.and_utc()));
471+
assert!(
472+
market_schedule.can_publish_at(
473+
&NaiveDateTime::parse_from_str("2023-04-22 09:00", format)?.and_utc()
474+
)
475+
);
467476

468477
// Date match in range
469-
assert!(market_schedule
470-
.can_publish_at(&NaiveDateTime::parse_from_str("2023-04-22 12:00", format)?.and_utc()));
478+
assert!(
479+
market_schedule.can_publish_at(
480+
&NaiveDateTime::parse_from_str("2023-04-22 12:00", format)?.and_utc()
481+
)
482+
);
471483

472484
// Date match at end of range
473-
assert!(market_schedule
474-
.can_publish_at(&NaiveDateTime::parse_from_str("2023-04-22 17:00", format)?.and_utc()));
485+
assert!(
486+
market_schedule.can_publish_at(
487+
&NaiveDateTime::parse_from_str("2023-04-22 17:00", format)?.and_utc()
488+
)
489+
);
475490

476491
// Date match after range
477-
assert!(!market_schedule
478-
.can_publish_at(&NaiveDateTime::parse_from_str("2023-04-22 17:01", format)?.and_utc()));
492+
assert!(
493+
!market_schedule.can_publish_at(
494+
&NaiveDateTime::parse_from_str("2023-04-22 17:01", format)?.and_utc()
495+
)
496+
);
479497

480498
// Date 2400 range
481-
assert!(market_schedule
482-
.can_publish_at(&NaiveDateTime::parse_from_str("2023-12-31 23:59", format)?.and_utc()));
499+
assert!(
500+
market_schedule.can_publish_at(
501+
&NaiveDateTime::parse_from_str("2023-12-31 23:59", format)?.and_utc()
502+
)
503+
);
483504

484505
// Sunday
485-
assert!(market_schedule
486-
.can_publish_at(&NaiveDateTime::parse_from_str("2024-04-14 12:00", format)?.and_utc()));
506+
assert!(
507+
market_schedule.can_publish_at(
508+
&NaiveDateTime::parse_from_str("2024-04-14 12:00", format)?.and_utc()
509+
)
510+
);
487511

488512
// Monday
489-
assert!(market_schedule
490-
.can_publish_at(&NaiveDateTime::parse_from_str("2024-04-15 12:00", format)?.and_utc()));
513+
assert!(
514+
market_schedule.can_publish_at(
515+
&NaiveDateTime::parse_from_str("2024-04-15 12:00", format)?.and_utc()
516+
)
517+
);
491518

492519
Ok(())
493520
}

src/agent/metrics.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use {
44
lazy_static::lazy_static,
55
prometheus_client::{
66
encoding::{
7-
text::encode,
87
EncodeLabelSet,
8+
text::encode,
99
},
1010
metrics::{
1111
counter::Counter,
@@ -20,17 +20,17 @@ use {
2020
std::{
2121
net::SocketAddr,
2222
sync::{
23-
atomic::AtomicU64,
2423
Arc,
24+
atomic::AtomicU64,
2525
},
2626
},
2727
tokio::sync::Mutex,
2828
warp::{
29-
hyper::StatusCode,
30-
reply,
3129
Filter,
3230
Rejection,
3331
Reply,
32+
hyper::StatusCode,
33+
reply,
3434
},
3535
};
3636

src/agent/pyth/rpc.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,31 @@ use {
1515
},
1616
crate::agent::state,
1717
anyhow::{
18-
anyhow,
1918
Result,
19+
anyhow,
2020
},
2121
futures::future::OptionFuture,
2222
futures_util::{
23+
SinkExt,
2324
stream::{
2425
SplitSink,
2526
SplitStream,
2627
StreamExt,
2728
},
28-
SinkExt,
2929
},
3030
jrpc::{
31-
parse_request,
3231
ErrorCode,
3332
Id,
3433
IdReq,
3534
Request,
3635
Response,
3736
Value,
37+
parse_request,
3838
},
3939
serde::{
40-
de::DeserializeOwned,
4140
Deserialize,
4241
Serialize,
42+
de::DeserializeOwned,
4343
},
4444
serde_this_or_that::{
4545
as_i64,
@@ -57,12 +57,12 @@ use {
5757
},
5858
tracing::instrument,
5959
warp::{
60+
Filter,
6061
ws::{
6162
Message,
6263
WebSocket,
6364
Ws,
6465
},
65-
Filter,
6666
},
6767
};
6868

src/agent/pyth/rpc/get_product.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use {
55
},
66
crate::agent::state,
77
anyhow::{
8-
anyhow,
98
Result,
9+
anyhow,
1010
},
1111
jrpc::{
1212
Request,

src/agent/pyth/rpc/subscribe_price.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use {
77
},
88
crate::agent::state,
99
anyhow::{
10-
anyhow,
1110
Result,
11+
anyhow,
1212
},
1313
jrpc::{
1414
Request,

src/agent/pyth/rpc/subscribe_price_sched.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use {
77
},
88
crate::agent::state,
99
anyhow::{
10-
anyhow,
1110
Result,
11+
anyhow,
1212
},
1313
jrpc::{
1414
Request,

src/agent/pyth/rpc/update_price.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use {
55
},
66
crate::agent::state,
77
anyhow::{
8-
anyhow,
98
Result,
9+
anyhow,
1010
},
1111
jrpc::{
1212
Request,

src/agent/services/exporter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,9 @@ mod exporter {
223223
},
224224
},
225225
state::exporter::{
226+
Exporter,
226227
get_publish_keypair,
227228
publish_batches,
228-
Exporter,
229229
},
230230
utils::rpc_multi_client::RpcMultiClient,
231231
},

0 commit comments

Comments
 (0)