diff --git a/.circleci/config.yml b/.circleci/config.yml index b3daedd..f6fd133 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -150,8 +150,8 @@ jobs: steps: - checkout - run: - name: Install protobuf and git - command: pacman -Sy --noconfirm protobuf git && protoc --version + name: Install protobuf and git and dependencies + command: pacman -Sy --noconfirm protobuf git gcc-libs && protoc --version - run: name: Regenerate descriptors working_directory: pbjson-types diff --git a/pbjson-build/src/generator/message.rs b/pbjson-build/src/generator/message.rs index 4203554..816bc4d 100644 --- a/pbjson-build/src/generator/message.rs +++ b/pbjson-build/src/generator/message.rs @@ -380,6 +380,11 @@ fn write_serialize_scalar_variable( "{}#[allow(clippy::needless_borrow)]", Indent(indent) )?; + writeln!( + writer, + "{}#[allow(clippy::needless_borrows_for_generic_args)]", + Indent(indent) + )?; writeln!( writer, "{}struct_ser.serialize_field(\"{}\", {}(&{}).as_str())?;", diff --git a/pbjson-types/descriptors.bin b/pbjson-types/descriptors.bin index 0e370ea..7757b3d 100644 Binary files a/pbjson-types/descriptors.bin and b/pbjson-types/descriptors.bin differ diff --git a/pbjson-types/src/timestamp.rs b/pbjson-types/src/timestamp.rs index e7a1fc5..a842e13 100644 --- a/pbjson-types/src/timestamp.rs +++ b/pbjson-types/src/timestamp.rs @@ -1,5 +1,5 @@ use crate::Timestamp; -use chrono::{DateTime, NaiveDateTime, TimeZone, Utc}; +use chrono::{DateTime, Utc}; use serde::de::Visitor; use serde::Serialize; @@ -8,14 +8,13 @@ impl TryFrom for DateTime { fn try_from(value: Timestamp) -> Result { let Timestamp { seconds, nanos } = value; - let dt = NaiveDateTime::from_timestamp_opt( + Self::from_timestamp( seconds, nanos .try_into() .map_err(|_| "out of range integral type conversion attempted")?, ) - .ok_or("invalid or out-of-range datetime")?; - Ok(Utc.from_utc_datetime(&dt)) + .ok_or("invalid or out-of-range datetime") } } @@ -33,7 +32,7 @@ impl Serialize for Timestamp { where S: serde::Serializer, { - let t: DateTime = self.clone().try_into().map_err(serde::ser::Error::custom)?; + let t: DateTime = (*self).try_into().map_err(serde::ser::Error::custom)?; serializer.serialize_str(t.to_rfc3339().as_str()) } } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index e724aeb..ba3f7e4 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.72" +channel = "1.74" components = ["rustfmt", "clippy"]