Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into use-doc-comment
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Jul 9, 2024
2 parents eb989d5 + 422824b commit 3a590e2
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pbjson-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ repository = "https://github.com/influxdata/pbjson"

[dependencies]
heck = "0.4"
prost = "0.12"
prost-types = "0.12"
prost = "0.13"
prost-types = "0.13"
itertools = "0.11"

[dev-dependencies]
Expand Down
5 changes: 5 additions & 0 deletions pbjson-build/src/generator/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,11 @@ fn write_serialize_scalar_variable<W: Write>(
"{}#[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())?;",
Expand Down
4 changes: 2 additions & 2 deletions pbjson-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description = "Test resources for pbjson converion"
repository = "https://github.com/influxdata/pbjson"

[dependencies]
prost = "0.12"
prost = "0.13"
pbjson = { path = "../pbjson" }
pbjson-types = { path = "../pbjson-types" }
serde = { version = "1.0", features = ["derive"] }
Expand All @@ -24,5 +24,5 @@ chrono = "0.4"
serde_json = "1.0"

[build-dependencies]
prost-build = "0.12"
prost-build = "0.13"
pbjson-build = { path = "../pbjson-build" }
4 changes: 2 additions & 2 deletions pbjson-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ exclude = ["protos/*"]
bytes = "1.0"
chrono = { version = "0.4", default-features = false, features = ["alloc"] }
pbjson = { path = "../pbjson", version = "0.6" }
prost = "0.12"
prost = "0.13"
serde = { version = "1.0", features = ["derive"] }

[dev-dependencies]
serde_json = "1.0"

[build-dependencies] # In alphabetical order
prost-build = "0.12"
prost-build = "0.13"
pbjson-build = { path = "../pbjson-build", version = "0.6" }
Binary file modified pbjson-types/descriptors.bin
Binary file not shown.
9 changes: 4 additions & 5 deletions pbjson-types/src/timestamp.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::Timestamp;
use chrono::{DateTime, NaiveDateTime, TimeZone, Utc};
use chrono::{DateTime, Utc};
use serde::de::Visitor;
use serde::Serialize;

Expand All @@ -8,14 +8,13 @@ impl TryFrom<Timestamp> for DateTime<Utc> {
fn try_from(value: Timestamp) -> Result<Self, Self::Error> {
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")
}
}

Expand All @@ -33,7 +32,7 @@ impl Serialize for Timestamp {
where
S: serde::Serializer,
{
let t: DateTime<Utc> = self.clone().try_into().map_err(serde::ser::Error::custom)?;
let t: DateTime<Utc> = (*self).try_into().map_err(serde::ser::Error::custom)?;
serializer.serialize_str(t.to_rfc3339().as_str())
}
}
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.72"
channel = "1.74"
components = ["rustfmt", "clippy"]

0 comments on commit 3a590e2

Please sign in to comment.