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

fix: codegen lint #153

Merged
merged 1 commit into from
May 5, 2023
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
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