Skip to content

Commit

Permalink
feat: remove parenthesis wrap in await
Browse files Browse the repository at this point in the history
  • Loading branch information
fMeow committed Oct 10, 2020
1 parent 5c4232a commit bc5f460
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/visit.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use proc_macro2::TokenStream;
use quote::quote;
use syn::{
parse_quote,
visit_mut::{self, VisitMut},
Attribute, Block, Expr, ExprBlock, File,
Expr, ExprBlock, File,
};

pub struct AsyncAwaitRemoval;
Expand All @@ -19,18 +18,7 @@ impl VisitMut for AsyncAwaitRemoval {
fn visit_expr_mut(&mut self, node: &mut Expr) {
match node {
Expr::Await(expr) => {
let mut attrs = expr.attrs.clone();
let allow: Attribute = parse_quote! {#[allow(unused_braces)]};
attrs.push(allow);

let inner = &expr.base;
let block: Block = parse_quote!({#inner});

*node = Expr::Block(ExprBlock {
attrs,
block,
label: None,
});
*node = *expr.base.clone();
}
Expr::Async(expr) => {
let inner = &expr.block;
Expand Down

0 comments on commit bc5f460

Please sign in to comment.