Merge pull request #941 from marcusklaas/type-ascription
Format type ascription
This commit is contained in:
commit
41e037da7e
@ -177,6 +177,9 @@ impl Rewrite for ast::Expr {
|
||||
ast::ExprKind::Cast(ref expr, ref ty) => {
|
||||
rewrite_pair(&**expr, &**ty, "", " as ", "", context, width, offset)
|
||||
}
|
||||
ast::ExprKind::Type(ref expr, ref ty) => {
|
||||
rewrite_pair(&**expr, &**ty, "", ": ", "", context, width, offset)
|
||||
}
|
||||
ast::ExprKind::Index(ref expr, ref index) => {
|
||||
rewrite_pair(&**expr, &**index, "", "[", "]", context, width, offset)
|
||||
}
|
||||
@ -210,8 +213,6 @@ impl Rewrite for ast::Expr {
|
||||
// satisfy our width restrictions.
|
||||
ast::ExprKind::InPlace(..) |
|
||||
ast::ExprKind::InlineAsm(..) |
|
||||
// TODO(#848): Handle type ascription
|
||||
ast::ExprKind::Type(_, _) |
|
||||
// TODO(#867): Handle try shorthand
|
||||
ast::ExprKind::Try(_) => {
|
||||
wrap_str(context.snippet(self.span),
|
||||
|
9
tests/source/type-ascription.rs
Normal file
9
tests/source/type-ascription.rs
Normal file
@ -0,0 +1,9 @@
|
||||
fn main() {
|
||||
let xxxxxxxxxxx = yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy : SomeTrait<AA, BB, CC>;
|
||||
|
||||
let xxxxxxxxxxxxxxx = yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;
|
||||
|
||||
let z = funk(yyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzz, wwwwww): AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;
|
||||
|
||||
x : u32 - 1u32 / 10f32 : u32
|
||||
}
|
14
tests/target/type-ascription.rs
Normal file
14
tests/target/type-ascription.rs
Normal file
@ -0,0 +1,14 @@
|
||||
fn main() {
|
||||
let xxxxxxxxxxx = yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy: SomeTrait<AA,
|
||||
BB,
|
||||
CC>;
|
||||
|
||||
let xxxxxxxxxxxxxxx =
|
||||
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;
|
||||
|
||||
let z = funk(yyyyyyyyyyyyyyy,
|
||||
zzzzzzzzzzzzzzzz,
|
||||
wwwwww): AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;
|
||||
|
||||
x: u32 - 1u32 / 10f32: u32
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user