@@ -108,9 +108,21 @@ pub(crate) fn format_expr(
108
108
ast:: ExprKind :: Unary ( op, ref subexpr) => rewrite_unary_op ( context, op, subexpr, shape) ,
109
109
ast:: ExprKind :: Struct ( ref struct_expr) => {
110
110
let ast:: StructExpr {
111
- fields, path, rest, ..
111
+ qself,
112
+ fields,
113
+ path,
114
+ rest,
112
115
} = & * * struct_expr;
113
- rewrite_struct_lit ( context, path, fields, rest, & expr. attrs , expr. span , shape)
116
+ rewrite_struct_lit (
117
+ context,
118
+ path,
119
+ qself. as_ref ( ) ,
120
+ fields,
121
+ rest,
122
+ & expr. attrs ,
123
+ expr. span ,
124
+ shape,
125
+ )
114
126
}
115
127
ast:: ExprKind :: Tup ( ref items) => {
116
128
rewrite_tuple ( context, items. iter ( ) , expr. span , shape, items. len ( ) == 1 )
@@ -1511,6 +1523,7 @@ fn struct_lit_can_be_aligned(fields: &[ast::ExprField], has_base: bool) -> bool
1511
1523
fn rewrite_struct_lit < ' a > (
1512
1524
context : & RewriteContext < ' _ > ,
1513
1525
path : & ast:: Path ,
1526
+ qself : Option < & ast:: QSelf > ,
1514
1527
fields : & ' a [ ast:: ExprField ] ,
1515
1528
struct_rest : & ast:: StructRest ,
1516
1529
attrs : & [ ast:: Attribute ] ,
@@ -1527,7 +1540,7 @@ fn rewrite_struct_lit<'a>(
1527
1540
1528
1541
// 2 = " {".len()
1529
1542
let path_shape = shape. sub_width ( 2 ) ?;
1530
- let path_str = rewrite_path ( context, PathContext :: Expr , None , path, path_shape) ?;
1543
+ let path_str = rewrite_path ( context, PathContext :: Expr , qself , path, path_shape) ?;
1531
1544
1532
1545
let has_base_or_rest = match struct_rest {
1533
1546
ast:: StructRest :: None if fields. is_empty ( ) => return Some ( format ! ( "{} {{}}" , path_str) ) ,
0 commit comments