Skip to content

Commit

Permalink
chore(codegen): use ::std::default::Default in struct's codegen (#295)
Browse files Browse the repository at this point in the history
always use ::std::default::Default
  • Loading branch information
flaneur2020 authored Jan 3, 2025
1 parent 946bde4 commit 34df6a0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pilota-build/src/plugin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ impl Plugin for ImplDefaultPlugin {
}
format!("{name}: {val}")
} else {
format!("{name}: Default::default()")
format!("{name}: ::std::default::Default::default()")
}
})
.join(",\n");
Expand All @@ -373,7 +373,7 @@ impl Plugin for ImplDefaultPlugin {
adj.add_nested_item(
format!(
r#"
impl Default for {name} {{
impl ::std::default::Default for {name} {{
fn default() -> Self {{
{name} {{
{fields}
Expand Down
6 changes: 3 additions & 3 deletions pilota-build/test_data/thrift/apache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ pub mod apache {
}
}
pub const MY_NUMBERZ: Numberz = Numberz::ONE;
impl Default for BoolTest {
impl ::std::default::Default for BoolTest {
fn default() -> Self {
BoolTest {
b: Some(true),
Expand Down Expand Up @@ -5269,7 +5269,7 @@ pub mod apache {
+ __protocol.struct_end_len()
}
}
impl Default for OptionalBinary {
impl ::std::default::Default for OptionalBinary {
fn default() -> Self {
OptionalBinary {
bin_map: Some({
Expand Down Expand Up @@ -20765,7 +20765,7 @@ pub mod apache {
)
}
}
impl Default for OptionalSetDefaultTest {
impl ::std::default::Default for OptionalSetDefaultTest {
fn default() -> Self {
OptionalSetDefaultTest {
with_default: Some(::pilota::AHashSet::from([
Expand Down
4 changes: 2 additions & 2 deletions pilota-build/test_data/thrift/default_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub mod default_value {
__protocol.i32_len(self.inner())
}
}
impl Default for C {
impl ::std::default::Default for C {
fn default() -> Self {
C {
off: Some(::pilota::FastStr::from_static_str("off")),
Expand Down Expand Up @@ -266,7 +266,7 @@ pub mod default_value {
+ __protocol.struct_end_len()
}
}
impl Default for A {
impl ::std::default::Default for A {
fn default() -> Self {
A {
faststr: ::pilota::FastStr::from_static_str("hello world"),
Expand Down
6 changes: 3 additions & 3 deletions pilota-build/test_data/thrift/multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub mod multi {

pub mod default_value {

impl Default for C {
impl ::std::default::Default for C {
fn default() -> Self {
C {
off: Some(::pilota::FastStr::from_static_str("off")),
Expand Down Expand Up @@ -268,7 +268,7 @@ pub mod multi {
__protocol.i32_len(self.inner())
}
}
impl Default for A {
impl ::std::default::Default for A {
fn default() -> Self {
A {
faststr: ::pilota::FastStr::from_static_str("hello world"),
Expand Down Expand Up @@ -949,7 +949,7 @@ pub mod multi {

pub mod multi {

impl Default for A {
impl ::std::default::Default for A {
fn default() -> Self {
A {
c: Some(super::default_value::C {
Expand Down

0 comments on commit 34df6a0

Please sign in to comment.