@@ -108,9 +108,21 @@ pub(crate) fn format_expr(
108108 ast:: ExprKind :: Unary ( op, ref subexpr) => rewrite_unary_op ( context, op, subexpr, shape) ,
109109 ast:: ExprKind :: Struct ( ref struct_expr) => {
110110 let ast:: StructExpr {
111- fields, path, rest, ..
111+ qself,
112+ fields,
113+ path,
114+ rest,
112115 } = & * * 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+ )
114126 }
115127 ast:: ExprKind :: Tup ( ref items) => {
116128 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
15111523fn rewrite_struct_lit < ' a > (
15121524 context : & RewriteContext < ' _ > ,
15131525 path : & ast:: Path ,
1526+ qself : Option < & ast:: QSelf > ,
15141527 fields : & ' a [ ast:: ExprField ] ,
15151528 struct_rest : & ast:: StructRest ,
15161529 attrs : & [ ast:: Attribute ] ,
@@ -1527,7 +1540,7 @@ fn rewrite_struct_lit<'a>(
15271540
15281541 // 2 = " {".len()
15291542 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) ?;
15311544
15321545 let has_base_or_rest = match struct_rest {
15331546 ast:: StructRest :: None if fields. is_empty ( ) => return Some ( format ! ( "{} {{}}" , path_str) ) ,
0 commit comments