From 2bae14852920fb43586cd6b544fa2f5b3d0aa0ff Mon Sep 17 00:00:00 2001 From: Tim Kuehn Date: Mon, 27 Jul 2020 00:04:35 -0700 Subject: [PATCH] Address clippy lints --- plugins/src/lib.rs | 4 ++-- tarpc/Cargo.toml | 1 + tarpc/src/rpc/util/serde.rs | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/src/lib.rs b/plugins/src/lib.rs index b6ce0cf..4c89de0 100644 --- a/plugins/src/lib.rs +++ b/plugins/src/lib.rs @@ -156,7 +156,7 @@ impl Parse for DeriveSerde { result, syn::Error::new( meta.span(), - format!("tarpc::service does not support this meta item") + "tarpc::service does not support this meta item" ) ); continue; @@ -167,7 +167,7 @@ impl Parse for DeriveSerde { result, syn::Error::new( meta.span(), - format!("tarpc::service does not support this meta item") + "tarpc::service does not support this meta item" ) ); continue; diff --git a/tarpc/Cargo.toml b/tarpc/Cargo.toml index bd481a7..482d3b7 100644 --- a/tarpc/Cargo.toml +++ b/tarpc/Cargo.toml @@ -48,6 +48,7 @@ log = "0.4" pin-utils = "0.1.0-alpha" tokio = { version = "0.2", features = ["full"] } tokio-serde = { version = "0.6", features = ["json"] } +trybuild = "1.0" [[example]] name = "server_calling_server" diff --git a/tarpc/src/rpc/util/serde.rs b/tarpc/src/rpc/util/serde.rs index 85af4d4..c9c62b5 100644 --- a/tarpc/src/rpc/util/serde.rs +++ b/tarpc/src/rpc/util/serde.rs @@ -15,9 +15,10 @@ pub fn serialize_epoch_secs(system_time: &SystemTime, serializer: S) -> Resul where S: Serializer, { + const ZERO_SECS: Duration = Duration::from_secs(0); system_time .duration_since(SystemTime::UNIX_EPOCH) - .unwrap_or(Duration::from_secs(0)) + .unwrap_or(ZERO_SECS) .as_secs() // Only care about second precision .serialize(serializer) }