From 388500de302c430e7ea25291f36a24f60a0a99e1 Mon Sep 17 00:00:00 2001 From: Geoffry Song Date: Sat, 2 Dec 2023 00:18:15 -0800 Subject: [PATCH] Remove TypeName_default lazy_statics, use OnceLock as needed instead --- pb-jelly-gen/codegen/codegen.py | 20 ++-- .../pb-jelly/proto_google/Cargo.toml.expected | 1 - .../pb-jelly/proto_google/src/lib.rs.expected | 2 - .../src/protobuf/empty.rs.expected | 3 - .../proto_nopackage/Cargo.toml.expected | 1 - .../proto_nopackage/src/lib.rs.expected | 2 - .../src/proto_nopackage.rs.expected | 3 - .../pb-jelly/proto_pbtest/Cargo.toml.expected | 1 - .../proto_pbtest/src/bench.rs.expected | 24 ---- .../pb-jelly/proto_pbtest/src/lib.rs.expected | 2 - .../proto_pbtest/src/mod/struct.rs.expected | 3 - .../proto_pbtest/src/pbtest2.rs.expected | 49 +------- .../proto_pbtest/src/pbtest3.rs.expected | 108 ------------------ .../proto_pbtest/src/servicepb.rs.expected | 6 - 14 files changed, 9 insertions(+), 216 deletions(-) diff --git a/pb-jelly-gen/codegen/codegen.py b/pb-jelly-gen/codegen/codegen.py index 095b8ea..16cc50b 100755 --- a/pb-jelly-gen/codegen/codegen.py +++ b/pb-jelly-gen/codegen/codegen.py @@ -459,8 +459,11 @@ def get_method(self) -> Tuple[Text, Text]: deref = "" if not self.is_boxed() else ".map(::std::ops::Deref::deref)" return ( "&" + self.rust_type(), - "self.%s.as_ref()%s.unwrap_or(&%s_default)" - % (name, deref, self.rust_type()), + "self.{name}.as_ref(){deref}.unwrap_or({{ \ +static DEFAULT: ::std::sync::OnceLock<{ty}> = ::std::sync::OnceLock::new(); \ +DEFAULT.get_or_init(<{ty} as ::std::default::Default>::default) }})".format( + name=name, deref=deref, ty=self.rust_type() + ), ) raise AssertionError("Unexpected field type") @@ -1063,12 +1066,6 @@ def gen_msg( ]: self.write("_unrecognized: Vec::new(),") - with block(self, "lazy_static!"): - self.write( - "pub static ref %s_default: %s = %s::default();" - % (name, escaped_name, escaped_name) - ) - with block(self, "impl ::pb_jelly::Message for " + escaped_name): with block( self, @@ -1795,8 +1792,6 @@ def get_lib_and_mod_rs( ) -> Iterator[Tuple[Text, Text]]: for crate, deps in self.deps_map.items(): librs = CodeWriter(None, None, None, None) # type: ignore - librs.write("#[macro_use]") - librs.write("extern crate lazy_static;") if derive_serde: librs.write("#[macro_use]") librs.write("extern crate serde;") @@ -1846,7 +1841,7 @@ def get_spec_toml_file( ) -> Iterator[Tuple[Text, Text]]: for crate, deps in self.deps_map.items(): all_deps = ( - {"lazy_static", "pb-jelly"} | deps | self.extra_crates[crate] + {"pb-jelly"} | deps | self.extra_crates[crate] ) - {"std"} features = { "serde": 'features=["serde_derive"]', @@ -1872,7 +1867,7 @@ def get_cargo_toml_file( ) -> Iterator[Tuple[Text, Text]]: for crate, deps in self.deps_map.items(): all_deps = ( - {"lazy_static", "pb-jelly"} | deps | self.extra_crates[crate] + {"pb-jelly"} | deps | self.extra_crates[crate] ) - {"std"} features = { "serde": 'features=["serde_derive"]', @@ -1887,7 +1882,6 @@ def get_cargo_toml_file( features.update({"compact_str": 'features=["bytes", "serde"]'}) versions = { - "lazy_static": ' version = "1.4.0" ', "pb-jelly": ' version = "0.0.14" ', "serde": ' version = "1.0" ', "bytes": ' version = "1.0" ', diff --git a/pb-test/gen/pb-jelly/proto_google/Cargo.toml.expected b/pb-test/gen/pb-jelly/proto_google/Cargo.toml.expected index ea6c165..807d4a3 100644 --- a/pb-test/gen/pb-jelly/proto_google/Cargo.toml.expected +++ b/pb-test/gen/pb-jelly/proto_google/Cargo.toml.expected @@ -6,5 +6,4 @@ edition = "2018" [dependencies] compact_str = {features=["bytes"], version = "0.5" } -lazy_static = { version = "1.4.0" } pb-jelly = { version = "0.0.14" } diff --git a/pb-test/gen/pb-jelly/proto_google/src/lib.rs.expected b/pb-test/gen/pb-jelly/proto_google/src/lib.rs.expected index 545fc3d..835dff9 100644 --- a/pb-test/gen/pb-jelly/proto_google/src/lib.rs.expected +++ b/pb-test/gen/pb-jelly/proto_google/src/lib.rs.expected @@ -21,7 +21,5 @@ // TODO: Ideally we don't allow this #![allow(clippy::match_single_binding)] -#[macro_use] -extern crate lazy_static; pub mod protobuf; diff --git a/pb-test/gen/pb-jelly/proto_google/src/protobuf/empty.rs.expected b/pb-test/gen/pb-jelly/proto_google/src/protobuf/empty.rs.expected index cebe182..f84c5c2 100644 --- a/pb-test/gen/pb-jelly/proto_google/src/protobuf/empty.rs.expected +++ b/pb-test/gen/pb-jelly/proto_google/src/protobuf/empty.rs.expected @@ -17,9 +17,6 @@ impl ::std::default::Default for Empty { } } } -lazy_static! { - pub static ref Empty_default: Empty = Empty::default(); -} impl ::pb_jelly::Message for Empty { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { diff --git a/pb-test/gen/pb-jelly/proto_nopackage/Cargo.toml.expected b/pb-test/gen/pb-jelly/proto_nopackage/Cargo.toml.expected index 43524fe..777eecd 100644 --- a/pb-test/gen/pb-jelly/proto_nopackage/Cargo.toml.expected +++ b/pb-test/gen/pb-jelly/proto_nopackage/Cargo.toml.expected @@ -6,5 +6,4 @@ edition = "2018" [dependencies] compact_str = {features=["bytes"], version = "0.5" } -lazy_static = { version = "1.4.0" } pb-jelly = { version = "0.0.14" } diff --git a/pb-test/gen/pb-jelly/proto_nopackage/src/lib.rs.expected b/pb-test/gen/pb-jelly/proto_nopackage/src/lib.rs.expected index eb602cc..7dd6000 100644 --- a/pb-test/gen/pb-jelly/proto_nopackage/src/lib.rs.expected +++ b/pb-test/gen/pb-jelly/proto_nopackage/src/lib.rs.expected @@ -21,7 +21,5 @@ // TODO: Ideally we don't allow this #![allow(clippy::match_single_binding)] -#[macro_use] -extern crate lazy_static; pub mod proto_nopackage; diff --git a/pb-test/gen/pb-jelly/proto_nopackage/src/proto_nopackage.rs.expected b/pb-test/gen/pb-jelly/proto_nopackage/src/proto_nopackage.rs.expected index 51fd506..5fd0f03 100644 --- a/pb-test/gen/pb-jelly/proto_nopackage/src/proto_nopackage.rs.expected +++ b/pb-test/gen/pb-jelly/proto_nopackage/src/proto_nopackage.rs.expected @@ -10,9 +10,6 @@ impl ::std::default::Default for NoPackage { } } } -lazy_static! { - pub static ref NoPackage_default: NoPackage = NoPackage::default(); -} impl ::pb_jelly::Message for NoPackage { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { diff --git a/pb-test/gen/pb-jelly/proto_pbtest/Cargo.toml.expected b/pb-test/gen/pb-jelly/proto_pbtest/Cargo.toml.expected index b6c29f5..cd4533e 100644 --- a/pb-test/gen/pb-jelly/proto_pbtest/Cargo.toml.expected +++ b/pb-test/gen/pb-jelly/proto_pbtest/Cargo.toml.expected @@ -7,6 +7,5 @@ edition = "2018" [dependencies] bytes = { version = "1.0" } compact_str = {features=["bytes"], version = "0.5" } -lazy_static = { version = "1.4.0" } pb-jelly = { version = "0.0.14" } proto_google = {path = "../proto_google"} diff --git a/pb-test/gen/pb-jelly/proto_pbtest/src/bench.rs.expected b/pb-test/gen/pb-jelly/proto_pbtest/src/bench.rs.expected index 71af84e..20005b0 100644 --- a/pb-test/gen/pb-jelly/proto_pbtest/src/bench.rs.expected +++ b/pb-test/gen/pb-jelly/proto_pbtest/src/bench.rs.expected @@ -22,9 +22,6 @@ impl ::std::default::Default for BytesData { } } } -lazy_static! { - pub static ref BytesData_default: BytesData = BytesData::default(); -} impl ::pb_jelly::Message for BytesData { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -138,9 +135,6 @@ impl ::std::default::Default for VecData { } } } -lazy_static! { - pub static ref VecData_default: VecData = VecData::default(); -} impl ::pb_jelly::Message for VecData { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -253,9 +247,6 @@ impl ::std::default::Default for StringMessage { } } } -lazy_static! { - pub static ref StringMessage_default: StringMessage = StringMessage::default(); -} impl ::pb_jelly::Message for StringMessage { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -368,9 +359,6 @@ impl ::std::default::Default for StringMessageSSO { } } } -lazy_static! { - pub static ref StringMessageSSO_default: StringMessageSSO = StringMessageSSO::default(); -} impl ::pb_jelly::Message for StringMessageSSO { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -483,9 +471,6 @@ impl ::std::default::Default for Cities { } } } -lazy_static! { - pub static ref Cities_default: Cities = Cities::default(); -} impl ::pb_jelly::Message for Cities { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -676,9 +661,6 @@ impl ::std::default::Default for City { } } } -lazy_static! { - pub static ref City_default: City = City::default(); -} impl ::pb_jelly::Message for City { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -1003,9 +985,6 @@ impl ::std::default::Default for CitiesSSO { } } } -lazy_static! { - pub static ref CitiesSSO_default: CitiesSSO = CitiesSSO::default(); -} impl ::pb_jelly::Message for CitiesSSO { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -1196,9 +1175,6 @@ impl ::std::default::Default for CitySSO { } } } -lazy_static! { - pub static ref CitySSO_default: CitySSO = CitySSO::default(); -} impl ::pb_jelly::Message for CitySSO { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { diff --git a/pb-test/gen/pb-jelly/proto_pbtest/src/lib.rs.expected b/pb-test/gen/pb-jelly/proto_pbtest/src/lib.rs.expected index a6f5407..efe6891 100644 --- a/pb-test/gen/pb-jelly/proto_pbtest/src/lib.rs.expected +++ b/pb-test/gen/pb-jelly/proto_pbtest/src/lib.rs.expected @@ -21,8 +21,6 @@ // TODO: Ideally we don't allow this #![allow(clippy::match_single_binding)] -#[macro_use] -extern crate lazy_static; pub mod bench; pub mod r#mod; diff --git a/pb-test/gen/pb-jelly/proto_pbtest/src/mod/struct.rs.expected b/pb-test/gen/pb-jelly/proto_pbtest/src/mod/struct.rs.expected index e8b133e..547588c 100644 --- a/pb-test/gen/pb-jelly/proto_pbtest/src/mod/struct.rs.expected +++ b/pb-test/gen/pb-jelly/proto_pbtest/src/mod/struct.rs.expected @@ -8,9 +8,6 @@ impl ::std::default::Default for Message { } } } -lazy_static! { - pub static ref Message_default: Message = Message::default(); -} impl ::pb_jelly::Message for Message { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { diff --git a/pb-test/gen/pb-jelly/proto_pbtest/src/pbtest2.rs.expected b/pb-test/gen/pb-jelly/proto_pbtest/src/pbtest2.rs.expected index f5a7549..79c23bb 100644 --- a/pb-test/gen/pb-jelly/proto_pbtest/src/pbtest2.rs.expected +++ b/pb-test/gen/pb-jelly/proto_pbtest/src/pbtest2.rs.expected @@ -461,9 +461,6 @@ impl ::std::default::Default for Option { } } } -lazy_static! { - pub static ref Option_default: Option = Option::default(); -} impl ::pb_jelly::Message for Option { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -523,9 +520,6 @@ impl ::std::default::Default for Vec { } } } -lazy_static! { - pub static ref Vec_default: Vec = Vec::default(); -} impl ::pb_jelly::Message for Vec { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -585,9 +579,6 @@ impl ::std::default::Default for Default { } } } -lazy_static! { - pub static ref Default_default: Default = Default::default(); -} impl ::pb_jelly::Message for Default { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -647,9 +638,6 @@ impl ::std::default::Default for String { } } } -lazy_static! { - pub static ref String_default: String = String::default(); -} impl ::pb_jelly::Message for String { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -715,9 +703,6 @@ impl ::std::default::Default for Version0OneOfNoneNullable { } } } -lazy_static! { - pub static ref Version0OneOfNoneNullable_default: Version0OneOfNoneNullable = Version0OneOfNoneNullable::default(); -} impl ::pb_jelly::Message for Version0OneOfNoneNullable { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -840,9 +825,6 @@ impl ::std::default::Default for Version1OneOfNoneNullable { } } } -lazy_static! { - pub static ref Version1OneOfNoneNullable_default: Version1OneOfNoneNullable = Version1OneOfNoneNullable::default(); -} impl ::pb_jelly::Message for Version1OneOfNoneNullable { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -1021,9 +1003,6 @@ impl ::std::default::Default for Version2OneOfNoneNullable { } } } -lazy_static! { - pub static ref Version2OneOfNoneNullable_default: Version2OneOfNoneNullable = Version2OneOfNoneNullable::default(); -} impl ::pb_jelly::Message for Version2OneOfNoneNullable { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -1249,9 +1228,6 @@ impl ::std::default::Default for Version1Enum { } } } -lazy_static! { - pub static ref Version1Enum_default: Version1Enum = Version1Enum::default(); -} impl ::pb_jelly::Message for Version1Enum { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -1356,9 +1332,6 @@ impl ::std::default::Default for Version2Enum { } } } -lazy_static! { - pub static ref Version2Enum_default: Version2Enum = Version2Enum::default(); -} impl ::pb_jelly::Message for Version2Enum { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -1458,9 +1431,6 @@ impl ::std::default::Default for Version1OneOf { } } } -lazy_static! { - pub static ref Version1OneOf_default: Version1OneOf = Version1OneOf::default(); -} impl ::pb_jelly::Message for Version1OneOf { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -1584,9 +1554,6 @@ impl ::std::default::Default for Version2OneOf { } } } -lazy_static! { - pub static ref Version2OneOf_default: Version2OneOf = Version2OneOf::default(); -} impl ::pb_jelly::Message for Version2OneOf { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -1761,9 +1728,6 @@ impl ::std::default::Default for Version1 { } } } -lazy_static! { - pub static ref Version1_default: Version1 = Version1::default(); -} impl ::pb_jelly::Message for Version1 { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -2025,9 +1989,6 @@ impl ::std::default::Default for Version2 { } } } -lazy_static! { - pub static ref Version2_default: Version2 = Version2::default(); -} impl ::pb_jelly::Message for Version2 { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -2563,9 +2524,6 @@ impl ::std::default::Default for ForeignMessage { } } } -lazy_static! { - pub static ref ForeignMessage_default: ForeignMessage = ForeignMessage::default(); -} impl ::pb_jelly::Message for ForeignMessage { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -2870,7 +2828,7 @@ impl TestMessage { self.optional_foreign_message.take().unwrap_or_default() } pub fn get_optional_foreign_message(&self) -> &ForeignMessage { - self.optional_foreign_message.as_ref().unwrap_or(&ForeignMessage_default) + self.optional_foreign_message.as_ref().unwrap_or({ static DEFAULT: ::std::sync::OnceLock = ::std::sync::OnceLock::new(); DEFAULT.get_or_init(::default) }) } pub fn has_optional_nested_enum(&self) -> bool { self.optional_nested_enum.is_some() @@ -3092,7 +3050,7 @@ impl TestMessage { self.optional_foreign_message_boxed.take().unwrap_or_default() } pub fn get_optional_foreign_message_boxed(&self) -> &ForeignMessage { - self.optional_foreign_message_boxed.as_ref().map(::std::ops::Deref::deref).unwrap_or(&ForeignMessage_default) + self.optional_foreign_message_boxed.as_ref().map(::std::ops::Deref::deref).unwrap_or({ static DEFAULT: ::std::sync::OnceLock = ::std::sync::OnceLock::new(); DEFAULT.get_or_init(::default) }) } pub fn has_type(&self) -> bool { self.r#type.is_some() @@ -3153,9 +3111,6 @@ impl ::std::default::Default for TestMessage { } } } -lazy_static! { - pub static ref TestMessage_default: TestMessage = TestMessage::default(); -} impl ::pb_jelly::Message for TestMessage { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { diff --git a/pb-test/gen/pb-jelly/proto_pbtest/src/pbtest3.rs.expected b/pb-test/gen/pb-jelly/proto_pbtest/src/pbtest3.rs.expected index 4a80285..ec95680 100644 --- a/pb-test/gen/pb-jelly/proto_pbtest/src/pbtest3.rs.expected +++ b/pb-test/gen/pb-jelly/proto_pbtest/src/pbtest3.rs.expected @@ -767,9 +767,6 @@ impl ::std::default::Default for ForeignMessage3 { } } } -lazy_static! { - pub static ref ForeignMessage3_default: ForeignMessage3 = ForeignMessage3::default(); -} impl ::pb_jelly::Message for ForeignMessage3 { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -871,9 +868,6 @@ impl ::std::default::Default for Version31OneOfNoneNullable { } } } -lazy_static! { - pub static ref Version31OneOfNoneNullable_default: Version31OneOfNoneNullable = Version31OneOfNoneNullable::default(); -} impl ::pb_jelly::Message for Version31OneOfNoneNullable { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -1050,9 +1044,6 @@ impl ::std::default::Default for Version32OneOfNoneNullable { } } } -lazy_static! { - pub static ref Version32OneOfNoneNullable_default: Version32OneOfNoneNullable = Version32OneOfNoneNullable::default(); -} impl ::pb_jelly::Message for Version32OneOfNoneNullable { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -1267,9 +1258,6 @@ impl ::std::default::Default for Version31Enum { } } } -lazy_static! { - pub static ref Version31Enum_default: Version31Enum = Version31Enum::default(); -} impl ::pb_jelly::Message for Version31Enum { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -1366,9 +1354,6 @@ impl ::std::default::Default for Version32Enum { } } } -lazy_static! { - pub static ref Version32Enum_default: Version32Enum = Version32Enum::default(); -} impl ::pb_jelly::Message for Version32Enum { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -1469,9 +1454,6 @@ impl ::std::default::Default for Version31OneOf { } } } -lazy_static! { - pub static ref Version31OneOf_default: Version31OneOf = Version31OneOf::default(); -} impl ::pb_jelly::Message for Version31OneOf { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -1593,9 +1575,6 @@ impl ::std::default::Default for Version32OneOf { } } } -lazy_static! { - pub static ref Version32OneOf_default: Version32OneOf = Version32OneOf::default(); -} impl ::pb_jelly::Message for Version32OneOf { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -1756,9 +1735,6 @@ impl ::std::default::Default for Version31 { } } } -lazy_static! { - pub static ref Version31_default: Version31 = Version31::default(); -} impl ::pb_jelly::Message for Version31 { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -1860,9 +1836,6 @@ impl ::std::default::Default for Version31SSO { } } } -lazy_static! { - pub static ref Version31SSO_default: Version31SSO = Version31SSO::default(); -} impl ::pb_jelly::Message for Version31SSO { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -1990,9 +1963,6 @@ impl ::std::default::Default for Version32 { } } } -lazy_static! { - pub static ref Version32_default: Version32 = Version32::default(); -} impl ::pb_jelly::Message for Version32 { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -2697,9 +2667,6 @@ impl ::std::default::Default for TestMessage3 { } } } -lazy_static! { - pub static ref TestMessage3_default: TestMessage3 = TestMessage3::default(); -} impl ::pb_jelly::Message for TestMessage3 { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -5369,9 +5336,6 @@ impl ::std::default::Default for TestMessage3_NestedMessage { } } } -lazy_static! { - pub static ref TestMessage3_NestedMessage_default: TestMessage3_NestedMessage = TestMessage3_NestedMessage::default(); -} impl ::pb_jelly::Message for TestMessage3_NestedMessage { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -5632,9 +5596,6 @@ impl ::std::default::Default for TestMessage3_NestedMessage_File { } } } -lazy_static! { - pub static ref TestMessage3_NestedMessage_File_default: TestMessage3_NestedMessage_File = TestMessage3_NestedMessage_File::default(); -} impl ::pb_jelly::Message for TestMessage3_NestedMessage_File { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -5766,9 +5727,6 @@ impl ::std::default::Default for TestMessage3_NestedMessage_Dir { } } } -lazy_static! { - pub static ref TestMessage3_NestedMessage_Dir_default: TestMessage3_NestedMessage_Dir = TestMessage3_NestedMessage_Dir::default(); -} impl ::pb_jelly::Message for TestMessage3_NestedMessage_Dir { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -5828,9 +5786,6 @@ impl ::std::default::Default for TestBoxedNonnullable { } } } -lazy_static! { - pub static ref TestBoxedNonnullable_default: TestBoxedNonnullable = TestBoxedNonnullable::default(); -} impl ::pb_jelly::Message for TestBoxedNonnullable { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -5939,9 +5894,6 @@ impl ::std::default::Default for TestMessage3NonNullableOneof { } } } -lazy_static! { - pub static ref TestMessage3NonNullableOneof_default: TestMessage3NonNullableOneof = TestMessage3NonNullableOneof::default(); -} impl ::pb_jelly::Message for TestMessage3NonNullableOneof { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -6137,9 +6089,6 @@ impl ::std::default::Default for TestMessage3ErrIfDefaultEnum { } } } -lazy_static! { - pub static ref TestMessage3ErrIfDefaultEnum_default: TestMessage3ErrIfDefaultEnum = TestMessage3ErrIfDefaultEnum::default(); -} impl ::pb_jelly::Message for TestMessage3ErrIfDefaultEnum { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -6241,9 +6190,6 @@ impl ::std::default::Default for TestMessage3ErrIfDefaultEnumOneof { } } } -lazy_static! { - pub static ref TestMessage3ErrIfDefaultEnumOneof_default: TestMessage3ErrIfDefaultEnumOneof = TestMessage3ErrIfDefaultEnumOneof::default(); -} impl ::pb_jelly::Message for TestMessage3ErrIfDefaultEnumOneof { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -6392,9 +6338,6 @@ impl ::std::default::Default for TestMessage3RepeatedErrIfDefaultEnum { } } } -lazy_static! { - pub static ref TestMessage3RepeatedErrIfDefaultEnum_default: TestMessage3RepeatedErrIfDefaultEnum = TestMessage3RepeatedErrIfDefaultEnum::default(); -} impl ::pb_jelly::Message for TestMessage3RepeatedErrIfDefaultEnum { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -6511,9 +6454,6 @@ impl ::std::default::Default for TestMessage3ClosedEnum { } } } -lazy_static! { - pub static ref TestMessage3ClosedEnum_default: TestMessage3ClosedEnum = TestMessage3ClosedEnum::default(); -} impl ::pb_jelly::Message for TestMessage3ClosedEnum { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -6610,9 +6550,6 @@ impl ::std::default::Default for TestMessage3ClosedEnum2 { } } } -lazy_static! { - pub static ref TestMessage3ClosedEnum2_default: TestMessage3ClosedEnum2 = TestMessage3ClosedEnum2::default(); -} impl ::pb_jelly::Message for TestMessage3ClosedEnum2 { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -6709,9 +6646,6 @@ impl ::std::default::Default for TestMessage3NonOptionalBoxedMessage { } } } -lazy_static! { - pub static ref TestMessage3NonOptionalBoxedMessage_default: TestMessage3NonOptionalBoxedMessage = TestMessage3NonOptionalBoxedMessage::default(); -} impl ::pb_jelly::Message for TestMessage3NonOptionalBoxedMessage { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -6813,9 +6747,6 @@ impl ::std::default::Default for TestMessage3NonOptionalBoxedMessage_InnerMessag } } } -lazy_static! { - pub static ref TestMessage3NonOptionalBoxedMessage_InnerMessage_default: TestMessage3NonOptionalBoxedMessage_InnerMessage = TestMessage3NonOptionalBoxedMessage_InnerMessage::default(); -} impl ::pb_jelly::Message for TestMessage3NonOptionalBoxedMessage_InnerMessage { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -6919,9 +6850,6 @@ impl ::std::default::Default for TestPreserveUnrecognized1 { } } } -lazy_static! { - pub static ref TestPreserveUnrecognized1_default: TestPreserveUnrecognized1 = TestPreserveUnrecognized1::default(); -} impl ::pb_jelly::Message for TestPreserveUnrecognized1 { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -7055,9 +6983,6 @@ impl ::std::default::Default for TestPreserveUnrecognized2 { } } } -lazy_static! { - pub static ref TestPreserveUnrecognized2_default: TestPreserveUnrecognized2 = TestPreserveUnrecognized2::default(); -} impl ::pb_jelly::Message for TestPreserveUnrecognized2 { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -7628,9 +7553,6 @@ impl ::std::default::Default for TestPreserveUnrecognizedEmpty { } } } -lazy_static! { - pub static ref TestPreserveUnrecognizedEmpty_default: TestPreserveUnrecognizedEmpty = TestPreserveUnrecognizedEmpty::default(); -} impl ::pb_jelly::Message for TestPreserveUnrecognizedEmpty { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -7695,9 +7617,6 @@ impl ::std::default::Default for TestSmallString { } } } -lazy_static! { - pub static ref TestSmallString_default: TestSmallString = TestSmallString::default(); -} impl ::pb_jelly::Message for TestSmallString { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -7799,9 +7718,6 @@ impl ::std::default::Default for TestBoxedSmallString { } } } -lazy_static! { - pub static ref TestBoxedSmallString_default: TestBoxedSmallString = TestBoxedSmallString::default(); -} impl ::pb_jelly::Message for TestBoxedSmallString { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -7903,9 +7819,6 @@ impl ::std::default::Default for TestNonOptionalSmallString { } } } -lazy_static! { - pub static ref TestNonOptionalSmallString_default: TestNonOptionalSmallString = TestNonOptionalSmallString::default(); -} impl ::pb_jelly::Message for TestNonOptionalSmallString { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -8009,9 +7922,6 @@ impl ::std::default::Default for TestSmallStringPreserveUnrecognized { } } } -lazy_static! { - pub static ref TestSmallStringPreserveUnrecognized_default: TestSmallStringPreserveUnrecognized = TestSmallStringPreserveUnrecognized::default(); -} impl ::pb_jelly::Message for TestSmallStringPreserveUnrecognized { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -8158,9 +8068,6 @@ impl ::std::default::Default for TestProto3Optional { } } } -lazy_static! { - pub static ref TestProto3Optional_default: TestProto3Optional = TestProto3Optional::default(); -} impl ::pb_jelly::Message for TestProto3Optional { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -8900,9 +8807,6 @@ impl ::std::default::Default for TestProto3Zerocopy { } } } -lazy_static! { - pub static ref TestProto3Zerocopy_default: TestProto3Zerocopy = TestProto3Zerocopy::default(); -} impl ::pb_jelly::Message for TestProto3Zerocopy { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -9054,9 +8958,6 @@ impl ::std::default::Default for RecursiveOneof { } } } -lazy_static! { - pub static ref RecursiveOneof_default: RecursiveOneof = RecursiveOneof::default(); -} impl ::pb_jelly::Message for RecursiveOneof { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -9385,9 +9286,6 @@ impl ::std::default::Default for MentionsKeywordPath { } } } -lazy_static! { - pub static ref MentionsKeywordPath_default: MentionsKeywordPath = MentionsKeywordPath::default(); -} impl ::pb_jelly::Message for MentionsKeywordPath { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -9490,9 +9388,6 @@ impl ::std::default::Default for NonNullableOneofKeyword { } } } -lazy_static! { - pub static ref NonNullableOneofKeyword_default: NonNullableOneofKeyword = NonNullableOneofKeyword::default(); -} impl ::pb_jelly::Message for NonNullableOneofKeyword { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -9603,9 +9498,6 @@ impl ::std::default::Default for NonNullableEnumKeyword { } } } -lazy_static! { - pub static ref NonNullableEnumKeyword_default: NonNullableEnumKeyword = NonNullableEnumKeyword::default(); -} impl ::pb_jelly::Message for NonNullableEnumKeyword { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { diff --git a/pb-test/gen/pb-jelly/proto_pbtest/src/servicepb.rs.expected b/pb-test/gen/pb-jelly/proto_pbtest/src/servicepb.rs.expected index 58e1d81..06dabc9 100644 --- a/pb-test/gen/pb-jelly/proto_pbtest/src/servicepb.rs.expected +++ b/pb-test/gen/pb-jelly/proto_pbtest/src/servicepb.rs.expected @@ -10,9 +10,6 @@ impl ::std::default::Default for InpMessage { } } } -lazy_static! { - pub static ref InpMessage_default: InpMessage = InpMessage::default(); -} impl ::pb_jelly::Message for InpMessage { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor { @@ -109,9 +106,6 @@ impl ::std::default::Default for OutMessage { } } } -lazy_static! { - pub static ref OutMessage_default: OutMessage = OutMessage::default(); -} impl ::pb_jelly::Message for OutMessage { fn descriptor(&self) -> ::std::option::Option<::pb_jelly::MessageDescriptor> { Some(::pb_jelly::MessageDescriptor {