mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-15 11:01:21 +00:00
derive(NetworkBehaviour) handles trailing commas (#874)
Properly handle trailing commas in derive(NetworkBehaviour)
This commit is contained in:
committed by
Pierre Krieger
parent
6d24596f9f
commit
615dd3332f
@ -112,7 +112,11 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> TokenStream {
|
||||
additional.push(quote!{#substream_generic: ::libp2p::tokio_io::AsyncWrite});
|
||||
|
||||
if let Some(where_clause) = where_clause {
|
||||
Some(quote!{#where_clause, #(#additional),*})
|
||||
if where_clause.predicates.trailing_punct() {
|
||||
Some(quote!{#where_clause #(#additional),*})
|
||||
} else {
|
||||
Some(quote!{#where_clause, #(#additional),*})
|
||||
}
|
||||
} else {
|
||||
Some(quote!{where #(#additional),*})
|
||||
}
|
||||
|
Reference in New Issue
Block a user