Explorar el Código

fmt, allow panic in tests

Mike Rolish hace 4 meses
padre
commit
0bb6f67eeb

+ 1 - 0
apps/pyth-lazer-agent/clippy.toml

@@ -1,3 +1,4 @@
 allow-unwrap-in-tests = true
 allow-expect-in-tests = true
 allow-indexing-slicing-in-tests = true
+allow-panic-in-tests = true

+ 4 - 1
apps/pyth-lazer-agent/src/main.rs

@@ -22,7 +22,10 @@ struct Cli {
 
 #[tokio::main]
 async fn main() -> anyhow::Result<()> {
-    #[allow(clippy::expect_used, reason = "application can fail on invalid RUST_LOG")]
+    #[allow(
+        clippy::expect_used,
+        reason = "application can fail on invalid RUST_LOG"
+    )]
     tracing_subscriber::fmt()
         .with_env_filter(
             EnvFilter::builder()

+ 16 - 4
apps/pyth-lazer-agent/src/publisher_handle.rs

@@ -88,9 +88,15 @@ async fn try_handle_publisher(
                 ) {
                     Ok((data, _)) => {
                         let source_timestamp = MessageField::some(Timestamp {
-                            #[allow(clippy::cast_possible_wrap, reason = "Unix seconds won't wrap any time soon")]
+                            #[allow(
+                                clippy::cast_possible_wrap,
+                                reason = "Unix seconds won't wrap any time soon"
+                            )]
                             seconds: (data.source_timestamp_us.0 / 1_000_000) as i64,
-                            #[allow(clippy::cast_possible_truncation, reason = "this value will always be less than one billion")]
+                            #[allow(
+                                clippy::cast_possible_truncation,
+                                reason = "this value will always be less than one billion"
+                            )]
                             nanos: (data.source_timestamp_us.0 % 1_000_000 * 1000) as i32,
                             special_fields: Default::default(),
                         });
@@ -133,9 +139,15 @@ async fn try_handle_publisher(
                 ) {
                     Ok((data, _)) => {
                         let source_timestamp = MessageField::some(Timestamp {
-                            #[allow(clippy::cast_possible_wrap, reason = "Unix seconds won't wrap any time soon")]
+                            #[allow(
+                                clippy::cast_possible_wrap,
+                                reason = "Unix seconds won't wrap any time soon"
+                            )]
                             seconds: (data.source_timestamp_us.0 / 1_000_000) as i64,
-                            #[allow(clippy::cast_possible_truncation, reason = "this value will always be less than one billion")]
+                            #[allow(
+                                clippy::cast_possible_truncation,
+                                reason = "this value will always be less than one billion"
+                            )]
                             nanos: (data.source_timestamp_us.0 % 1_000_000 * 1000) as i32,
                             special_fields: Default::default(),
                         });