]> git.lizzy.rs Git - rust.git/commitdiff
fix path wrong display
authorDezhi Wu <wu543065657@163.com>
Tue, 7 Sep 2021 08:54:02 +0000 (16:54 +0800)
committerDezhi Wu <wu543065657@163.com>
Tue, 7 Sep 2021 08:54:02 +0000 (16:54 +0800)
crates/hir_ty/src/display.rs

index 6281e3c2a5528174e13902782c20307b3fd5cd1a..e394b72d5d639db4e7465fac529cb5c5f0dc33b3 100644 (file)
@@ -1141,7 +1141,7 @@ fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
                 write!(f, ">")?;
             }
             (_, PathKind::Plain) => {}
-            (_, PathKind::Abs) => write!(f, "::")?,
+            (_, PathKind::Abs) => write!(f, "")?,
             (_, PathKind::Crate) => write!(f, "crate")?,
             (_, PathKind::Super(0)) => write!(f, "self")?,
             (_, PathKind::Super(n)) => {
@@ -1154,7 +1154,7 @@ fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
         }
 
         for (seg_idx, segment) in self.segments().iter().enumerate() {
-            if seg_idx != 0 || matches!(self.kind(), PathKind::Crate) {
+            if !matches!(self.kind(), PathKind::Plain) || seg_idx > 0 {
                 write!(f, "::")?;
             }
             write!(f, "{}", segment.name)?;