Skip to content

Commit

Permalink
use absolute path of std::default::Default
Browse files Browse the repository at this point in the history
  • Loading branch information
flaneur2020 committed Jan 2, 2025
1 parent d5255ab commit 6934fef
Show file tree
Hide file tree
Showing 26 changed files with 347 additions and 225 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 @@ -410,14 +410,14 @@ impl Plugin for ImplDefaultPlugin {
let fields = first_variant
.fields
.iter()
.map(|_| "Default::default()".to_string())
.map(|_| "::std::default::Default::default()".to_string())
.join(",\n");

cx.with_adjust_mut(def_id, |adj| {
adj.add_nested_item(
format!(
r#"
impl Default for {enum_name} {{
impl ::std::default::Default for {enum_name} {{
fn default() -> Self {{
{enum_name}::{variant_name} ({fields})
}}
Expand Down
8 changes: 4 additions & 4 deletions pilota-build/test_data/protobuf/oneof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ pub mod oneof {

pub mod test {

impl Default for Test {
impl ::std::default::Default for Test {
fn default() -> Self {
Test::A(Default::default())
Test::A(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -171,9 +171,9 @@ pub mod oneof {
::core::result::Result::Ok(())
}
}
impl Default for Type {
impl ::std::default::Default for Type {
fn default() -> Self {
Type::S(Default::default())
Type::S(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down
204 changes: 102 additions & 102 deletions pilota-build/test_data/thrift/apache.rs

Large diffs are not rendered by default.

64 changes: 32 additions & 32 deletions pilota-build/test_data/thrift/auto_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ pub mod auto_name {
}
pub trait service {}

impl Default for serviceTest2ResultRecv {
impl ::std::default::Default for serviceTest2ResultRecv {
fn default() -> Self {
serviceTest2ResultRecv::Ok(Default::default())
serviceTest2ResultRecv::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -740,9 +740,9 @@ pub mod auto_name {
+ __protocol.struct_end_len()
}
}
impl Default for servicetestResultSend {
impl ::std::default::Default for servicetestResultSend {
fn default() -> Self {
servicetestResultSend::Ok(Default::default())
servicetestResultSend::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -1238,9 +1238,9 @@ pub mod auto_name {
+ __protocol.struct_end_len()
}
}
impl Default for ServicetestException {
impl ::std::default::Default for ServicetestException {
fn default() -> Self {
ServicetestException::E(Default::default())
ServicetestException::E(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -1382,9 +1382,9 @@ pub mod auto_name {
+ __protocol.struct_end_len()
}
}
impl Default for ServicetestResultRecv {
impl ::std::default::Default for ServicetestResultRecv {
fn default() -> Self {
ServicetestResultRecv::Ok(Default::default())
ServicetestResultRecv::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -1565,9 +1565,9 @@ pub mod auto_name {
}
}
pub const IP: &'static str = "IP";
impl Default for serviceTest2ResultSend {
impl ::std::default::Default for serviceTest2ResultSend {
fn default() -> Self {
serviceTest2ResultSend::Ok(Default::default())
serviceTest2ResultSend::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -1709,9 +1709,9 @@ pub mod auto_name {
+ __protocol.struct_end_len()
}
}
impl Default for serviceTestException {
impl ::std::default::Default for serviceTestException {
fn default() -> Self {
serviceTestException::E(Default::default())
serviceTestException::E(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -1853,9 +1853,9 @@ pub mod auto_name {
+ __protocol.struct_end_len()
}
}
impl Default for serviceTestResultRecv {
impl ::std::default::Default for serviceTestResultRecv {
fn default() -> Self {
serviceTestResultRecv::Ok(Default::default())
serviceTestResultRecv::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -2351,9 +2351,9 @@ pub mod auto_name {
+ __protocol.struct_end_len()
}
}
impl Default for ServiceTestResultSend {
impl ::std::default::Default for ServiceTestResultSend {
fn default() -> Self {
ServiceTestResultSend::Ok(Default::default())
ServiceTestResultSend::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -2725,9 +2725,9 @@ pub mod auto_name {
}
pub trait Service {}

impl Default for ServiceTest2ResultRecv {
impl ::std::default::Default for ServiceTest2ResultRecv {
fn default() -> Self {
ServiceTest2ResultRecv::Ok(Default::default())
ServiceTest2ResultRecv::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -3474,9 +3474,9 @@ pub mod auto_name {
+ __protocol.struct_end_len()
}
}
impl Default for servicetestException {
impl ::std::default::Default for servicetestException {
fn default() -> Self {
servicetestException::E(Default::default())
servicetestException::E(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -3618,9 +3618,9 @@ pub mod auto_name {
+ __protocol.struct_end_len()
}
}
impl Default for servicetestResultRecv {
impl ::std::default::Default for servicetestResultRecv {
fn default() -> Self {
servicetestResultRecv::Ok(Default::default())
servicetestResultRecv::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -4000,9 +4000,9 @@ pub mod auto_name {
+ __protocol.struct_end_len()
}
}
impl Default for ServicetestResultSend {
impl ::std::default::Default for ServicetestResultSend {
fn default() -> Self {
ServicetestResultSend::Ok(Default::default())
ServicetestResultSend::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -4498,9 +4498,9 @@ pub mod auto_name {
+ __protocol.struct_end_len()
}
}
impl Default for serviceTestResultSend {
impl ::std::default::Default for serviceTestResultSend {
fn default() -> Self {
serviceTestResultSend::Ok(Default::default())
serviceTestResultSend::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -4680,9 +4680,9 @@ pub mod auto_name {
+ __protocol.struct_end_len()
}
}
impl Default for ServiceTest2ResultSend {
impl ::std::default::Default for ServiceTest2ResultSend {
fn default() -> Self {
ServiceTest2ResultSend::Ok(Default::default())
ServiceTest2ResultSend::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -4824,9 +4824,9 @@ pub mod auto_name {
+ __protocol.struct_end_len()
}
}
impl Default for ServiceTestException {
impl ::std::default::Default for ServiceTestException {
fn default() -> Self {
ServiceTestException::E(Default::default())
ServiceTestException::E(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -4968,9 +4968,9 @@ pub mod auto_name {
+ __protocol.struct_end_len()
}
}
impl Default for ServiceTestResultRecv {
impl ::std::default::Default for ServiceTestResultRecv {
fn default() -> Self {
ServiceTestResultRecv::Ok(Default::default())
ServiceTestResultRecv::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down
16 changes: 8 additions & 8 deletions pilota-build/test_data/thrift/enum_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,9 @@ pub mod enum_test {
+ __protocol.struct_end_len()
}
}
impl Default for TestTestEnumVarTypeNameConflictResultSend {
impl ::std::default::Default for TestTestEnumVarTypeNameConflictResultSend {
fn default() -> Self {
TestTestEnumVarTypeNameConflictResultSend::Ok(Default::default())
TestTestEnumVarTypeNameConflictResultSend::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -939,9 +939,9 @@ pub mod enum_test {
+ __protocol.struct_end_len()
}
}
impl Default for TestTestEnumResultSend {
impl ::std::default::Default for TestTestEnumResultSend {
fn default() -> Self {
TestTestEnumResultSend::Ok(Default::default())
TestTestEnumResultSend::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -1384,9 +1384,9 @@ pub mod enum_test {
}
pub trait Test {}

impl Default for TestTestEnumVarTypeNameConflictResultRecv {
impl ::std::default::Default for TestTestEnumVarTypeNameConflictResultRecv {
fn default() -> Self {
TestTestEnumVarTypeNameConflictResultRecv::Ok(Default::default())
TestTestEnumVarTypeNameConflictResultRecv::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -1532,9 +1532,9 @@ pub mod enum_test {
+ __protocol.struct_end_len()
}
}
impl Default for TestTestEnumResultRecv {
impl ::std::default::Default for TestTestEnumResultRecv {
fn default() -> Self {
TestTestEnumResultRecv::Ok(Default::default())
TestTestEnumResultRecv::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down
20 changes: 10 additions & 10 deletions pilota-build/test_data/thrift/normal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1062,9 +1062,9 @@ pub mod normal {
+ __protocol.struct_end_len()
}
}
impl Default for TestTest123ResultSend {
impl ::std::default::Default for TestTest123ResultSend {
fn default() -> Self {
TestTest123ResultSend::Ok(Default::default())
TestTest123ResultSend::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -1609,9 +1609,9 @@ pub mod normal {
+ __protocol.struct_end_len()
}
}
impl Default for TestTestExceptionException {
impl ::std::default::Default for TestTestExceptionException {
fn default() -> Self {
TestTestExceptionException::StException(Default::default())
TestTestExceptionException::StException(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -1754,9 +1754,9 @@ pub mod normal {
+ __protocol.struct_end_len()
}
}
impl Default for TestTestExceptionResultSend {
impl ::std::default::Default for TestTestExceptionResultSend {
fn default() -> Self {
TestTestExceptionResultSend::Ok(Default::default())
TestTestExceptionResultSend::Ok(::std::default::Default::default())
}
}
#[derive(Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -1937,9 +1937,9 @@ pub mod normal {
+ __protocol.struct_end_len()
}
}
impl Default for TestTestExceptionResultRecv {
impl ::std::default::Default for TestTestExceptionResultRecv {
fn default() -> Self {
TestTestExceptionResultRecv::Ok(Default::default())
TestTestExceptionResultRecv::Ok(::std::default::Default::default())
}
}
#[derive(Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -2120,9 +2120,9 @@ pub mod normal {
+ __protocol.struct_end_len()
}
}
impl Default for TestTest123ResultRecv {
impl ::std::default::Default for TestTest123ResultRecv {
fn default() -> Self {
TestTest123ResultRecv::Ok(Default::default())
TestTest123ResultRecv::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down
8 changes: 4 additions & 4 deletions pilota-build/test_data/thrift/pilota_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,9 @@ pub mod pilota_name {
+ __protocol.struct_end_len()
}
}
impl Default for TestServiceTestResultSend {
impl ::std::default::Default for TestServiceTestResultSend {
fn default() -> Self {
TestServiceTestResultSend::Ok(Default::default())
TestServiceTestResultSend::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -802,9 +802,9 @@ pub mod pilota_name {
pub const LANG_ID: &'static str = "id";
pub trait TestService {}

impl Default for TestServiceTestResultRecv {
impl ::std::default::Default for TestServiceTestResultRecv {
fn default() -> Self {
TestServiceTestResultRecv::Ok(Default::default())
TestServiceTestResultRecv::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down
8 changes: 4 additions & 4 deletions pilota-build/test_data/thrift/underscore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pub mod underscore {

pub mod underscore {

impl Default for Test_UnderscoredResultRecv {
impl ::std::default::Default for Test_UnderscoredResultRecv {
fn default() -> Self {
Test_UnderscoredResultRecv::Ok(Default::default())
Test_UnderscoredResultRecv::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -443,9 +443,9 @@ pub mod underscore {
+ __protocol.struct_end_len()
}
}
impl Default for Test_UnderscoredResultSend {
impl ::std::default::Default for Test_UnderscoredResultSend {
fn default() -> Self {
Test_UnderscoredResultSend::Ok(Default::default())
Test_UnderscoredResultSend::Ok(::std::default::Default::default())
}
}
#[derive(PartialOrd, Hash, Eq, Ord, Debug, Clone, PartialEq)]
Expand Down
Loading

0 comments on commit 6934fef

Please sign in to comment.