Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(codegen): use ::std::default::Default in struct's codegen #295

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading