Skip to content

Commit

Permalink
fix: codegen lint
Browse files Browse the repository at this point in the history
  • Loading branch information
LYF1999 committed May 5, 2023
1 parent e2702c9 commit b1a75ab
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 34 deletions.
2 changes: 1 addition & 1 deletion pilota-build/src/codegen/thrift/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ impl ThriftBackend {
let map_ident = {read_map_begin};
let mut val = ::std::collections::HashMap::with_capacity(map_ident.size);
for _ in 0..map_ident.size {{
val.insert({{{read_el_key}}}, {{{read_el_val}}});
val.insert({read_el_key}, {read_el_val});
}}
{read_map_end};
val
Expand Down
14 changes: 8 additions & 6 deletions pilota-build/test_data/thrift/default_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,10 @@ pub mod default_value {
let mut val =
::std::collections::HashMap::with_capacity(map_ident.size);
for _ in 0..map_ident.size {
val.insert({ protocol.read_faststr()? }, {
protocol.read_faststr()?
});
val.insert(
protocol.read_faststr()?,
protocol.read_faststr()?,
);
}
protocol.read_map_end()?;
val
Expand Down Expand Up @@ -350,9 +351,10 @@ pub mod default_value {
let mut val =
::std::collections::HashMap::with_capacity(map_ident.size);
for _ in 0..map_ident.size {
val.insert({ protocol.read_faststr().await? }, {
protocol.read_faststr().await?
});
val.insert(
protocol.read_faststr().await?,
protocol.read_faststr().await?,
);
}
protocol.read_map_end().await?;
val
Expand Down
48 changes: 21 additions & 27 deletions pilota-build/test_data/thrift/wrapper_arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,20 +393,16 @@ pub mod wrapper_arc {
let mut val =
::std::collections::HashMap::with_capacity(map_ident.size);
for _ in 0..map_ident.size {
val.insert({ protocol.read_i32()? }, {
{
let list_ident = protocol.read_list_begin()?;
let mut val = Vec::with_capacity(list_ident.size);
for _ in 0..list_ident.size {
val.push(::std::sync::Arc::new(
::pilota::thrift::Message::decode(
protocol,
)?,
));
}
protocol.read_list_end()?;
val
val.insert(protocol.read_i32()?, {
let list_ident = protocol.read_list_begin()?;
let mut val = Vec::with_capacity(list_ident.size);
for _ in 0..list_ident.size {
val.push(::std::sync::Arc::new(
::pilota::thrift::Message::decode(protocol)?,
));
}
protocol.read_list_end()?;
val
});
}
protocol.read_map_end()?;
Expand Down Expand Up @@ -520,21 +516,19 @@ pub mod wrapper_arc {
let mut val =
::std::collections::HashMap::with_capacity(map_ident.size);
for _ in 0..map_ident.size {
val.insert({ protocol.read_i32().await? }, {
{
let list_ident = protocol.read_list_begin().await?;
let mut val = Vec::with_capacity(list_ident.size);
for _ in 0..list_ident.size {
val.push(::std::sync::Arc::new(
::pilota::thrift::Message::decode_async(
protocol,
)
.await?,
));
}
protocol.read_list_end().await?;
val
val.insert(protocol.read_i32().await?, {
let list_ident = protocol.read_list_begin().await?;
let mut val = Vec::with_capacity(list_ident.size);
for _ in 0..list_ident.size {
val.push(::std::sync::Arc::new(
::pilota::thrift::Message::decode_async(
protocol,
)
.await?,
));
}
protocol.read_list_end().await?;
val
});
}
protocol.read_map_end().await?;
Expand Down

0 comments on commit b1a75ab

Please sign in to comment.