From 7800f587876f5103e938f3a37a9155bc6c1f6ef9 Mon Sep 17 00:00:00 2001 From: Farhad Shabani Date: Thu, 4 Jan 2024 22:40:19 -0800 Subject: [PATCH 1/3] fix: restore #[no_std] attribute --- Cargo.toml | 2 +- src/lib.rs | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f2a09989..bfd16e40 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,7 +56,7 @@ serde_json = "1.0.107" [features] default = ["std", "client"] -std = ["prost/std", "bytes/std", "subtle-encoding/std", "base64/std", "flex-error/std", "ics23/std"] +std = ["prost/std", "bytes/std", "subtle-encoding/std", "base64/std", "flex-error/std", "ics23/std", "informalsystems-pbjson/std"] serde = ["dep:serde", "ics23/serde", "informalsystems-pbjson"] client = ["std", "dep:tonic", "tonic/codegen", "tonic/transport", "tonic/prost"] json-schema = ["std", "serde", "dep:schemars"] diff --git a/src/lib.rs b/src/lib.rs index 3a821998..f32a2f6f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,11 +2,8 @@ // Todo: automate the creation of this module setup based on the dots in the filenames. // This module setup is necessary because the generated code contains "super::" calls for dependencies. - -#![cfg_attr( - not(feature = "serde"), - deny(warnings, trivial_casts, trivial_numeric_casts, unused_import_braces) -)] +#![cfg_attr(not(feature = "std"), no_std)] +#![deny(warnings, trivial_casts, trivial_numeric_casts, unused_import_braces)] #![allow(clippy::large_enum_variant, clippy::derive_partial_eq_without_eq)] #![allow(rustdoc::bare_urls)] #![forbid(unsafe_code)] From 08b0fdb55606a08a3f2a10b00732a6948a087d0a Mon Sep 17 00:00:00 2001 From: Farhad Shabani Date: Thu, 4 Jan 2024 23:15:37 -0800 Subject: [PATCH 2/3] fix: clippy v0.1.75 catches --- src/prost/google.protobuf.serde.rs | 2 +- src/prost/ibc.core.channel.v1.serde.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/prost/google.protobuf.serde.rs b/src/prost/google.protobuf.serde.rs index 34f08208..a974819b 100644 --- a/src/prost/google.protobuf.serde.rs +++ b/src/prost/google.protobuf.serde.rs @@ -4828,7 +4828,7 @@ impl serde::Serialize for UninterpretedOption { struct_ser.serialize_field("doubleValue", v)?; } if let Some(v) = self.string_value.as_ref() { - struct_ser.serialize_field("stringValue", pbjson::private::base64::encode(&v).as_str())?; + struct_ser.serialize_field("stringValue", pbjson::private::base64::encode(v).as_str())?; } if let Some(v) = self.aggregate_value.as_ref() { struct_ser.serialize_field("aggregateValue", v)?; diff --git a/src/prost/ibc.core.channel.v1.serde.rs b/src/prost/ibc.core.channel.v1.serde.rs index 8f746f11..cd67218c 100644 --- a/src/prost/ibc.core.channel.v1.serde.rs +++ b/src/prost/ibc.core.channel.v1.serde.rs @@ -13,7 +13,7 @@ impl serde::Serialize for Acknowledgement { if let Some(v) = self.response.as_ref() { match v { acknowledgement::Response::Result(v) => { - struct_ser.serialize_field("result", pbjson::private::base64::encode(&v).as_str())?; + struct_ser.serialize_field("result", pbjson::private::base64::encode(v).as_str())?; } acknowledgement::Response::Error(v) => { struct_ser.serialize_field("error", v)?; From fb98e13f4a496cfb2f13970ac2eafd782243cd8f Mon Sep 17 00:00:00 2001 From: Farhad Shabani Date: Fri, 5 Jan 2024 06:19:45 -0800 Subject: [PATCH 3/3] chore: add unclog --- .changelog/unreleased/bug-fixes/171-restore-no-std-attribute.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .changelog/unreleased/bug-fixes/171-restore-no-std-attribute.md diff --git a/.changelog/unreleased/bug-fixes/171-restore-no-std-attribute.md b/.changelog/unreleased/bug-fixes/171-restore-no-std-attribute.md new file mode 100644 index 00000000..682c8313 --- /dev/null +++ b/.changelog/unreleased/bug-fixes/171-restore-no-std-attribute.md @@ -0,0 +1,2 @@ +- Fix `#[no_std]` attribute removal and add `informalsystems-pbjson/std` dependency + for `std` feature ([#171](https://github.com/cosmos/ibc-proto-rs/issues/171)).