about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAshvin Arsakularatne <ashvin.arsakularatne@gmail.com>2021-08-26 00:21:29 +0530
committerCaleb Cartwright <calebcartwright@users.noreply.github.com>2021-08-25 21:18:41 -0500
commite81c393663daab11238944cddfbd97541630f178 (patch)
tree2bc2c7441b8b4e63e9b02c1eb1e27a1f99ba4e01 /src
parentfd6b025e8a5ab0bf0356030cab98575dca397f69 (diff)
downloadrust-e81c393663daab11238944cddfbd97541630f178.tar.gz
rust-e81c393663daab11238944cddfbd97541630f178.zip
fix: remove wrong reformatting of qualified paths in struct patterns
Diffstat (limited to 'src')
-rw-r--r--src/patterns.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/patterns.rs b/src/patterns.rs
index 062e9cef9bb..0c6a6f3e814 100644
--- a/src/patterns.rs
+++ b/src/patterns.rs
@@ -244,8 +244,8 @@ impl Rewrite for Pat {
                     .collect();
                 Some(format!("[{}]", rw.join(", ")))
             }
-            PatKind::Struct(_, ref path, ref fields, ellipsis) => {
-                rewrite_struct_pat(path, fields, ellipsis, self.span, context, shape)
+            PatKind::Struct(ref qself, ref path, ref fields, ellipsis) => {
+                rewrite_struct_pat(qself, path, fields, ellipsis, self.span, context, shape)
             }
             PatKind::MacCall(ref mac) => {
                 rewrite_macro(mac, None, context, shape, MacroPosition::Pat)
@@ -258,6 +258,7 @@ impl Rewrite for Pat {
 }
 
 fn rewrite_struct_pat(
+    qself: &Option<ast::QSelf>,
     path: &ast::Path,
     fields: &[ast::PatField],
     ellipsis: bool,
@@ -267,7 +268,7 @@ fn rewrite_struct_pat(
 ) -> Option<String> {
     // 2 =  ` {`
     let path_shape = shape.sub_width(2)?;
-    let path_str = rewrite_path(context, PathContext::Expr, None, path, path_shape)?;
+    let path_str = rewrite_path(context, PathContext::Expr, qself.as_ref(), path, path_shape)?;
 
     if fields.is_empty() && !ellipsis {
         return Some(format!("{} {{}}", path_str));