feat: support underscore expressions
This commit is contained in:
parent
5c0673c371
commit
4d9fa00fd5
@ -384,6 +384,7 @@ pub(crate) fn format_expr(
|
||||
}
|
||||
}
|
||||
ast::ExprKind::Await(_) => rewrite_chain(expr, context, shape),
|
||||
ast::ExprKind::Underscore => Some("_".to_owned()),
|
||||
ast::ExprKind::Err => None,
|
||||
};
|
||||
|
||||
|
@ -504,7 +504,8 @@ pub(crate) fn is_block_expr(context: &RewriteContext<'_>, expr: &ast::Expr, repr
|
||||
| ast::ExprKind::Ret(..)
|
||||
| ast::ExprKind::Tup(..)
|
||||
| ast::ExprKind::Type(..)
|
||||
| ast::ExprKind::Yield(None) => false,
|
||||
| ast::ExprKind::Yield(None)
|
||||
| ast::ExprKind::Underscore => false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -567,3 +567,13 @@ fn foo() {
|
||||
}
|
||||
.await;
|
||||
}
|
||||
|
||||
fn underscore() {
|
||||
_= 1;
|
||||
_;
|
||||
[ _,a,_ ] = [1, 2, 3];
|
||||
(a, _) = (8, 9);
|
||||
TupleStruct( _, a) = TupleStruct(2, 2);
|
||||
|
||||
let _ : usize = foo(_, _);
|
||||
}
|
||||
|
@ -659,3 +659,13 @@ fn foo() {
|
||||
}
|
||||
.await;
|
||||
}
|
||||
|
||||
fn underscore() {
|
||||
_ = 1;
|
||||
_;
|
||||
[_, a, _] = [1, 2, 3];
|
||||
(a, _) = (8, 9);
|
||||
TupleStruct(_, a) = TupleStruct(2, 2);
|
||||
|
||||
let _: usize = foo(_, _);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user