Skip to content

Commit 018266a

Browse files
committed
Make ModPath display escaped path
1 parent 8fe73a2 commit 018266a

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

crates/hir-expand/src/mod_path.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub struct ModPath {
2222
}
2323

2424
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
25-
pub struct EscapedModPath<'a>(&'a ModPath);
25+
pub struct UnescapedModPath<'a>(&'a ModPath);
2626

2727
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
2828
pub enum PathKind {
@@ -102,8 +102,8 @@ impl ModPath {
102102
}
103103
}
104104

105-
pub fn escaped(&self) -> EscapedModPath<'_> {
106-
EscapedModPath(self)
105+
pub fn unescaped(&self) -> UnescapedModPath<'_> {
106+
UnescapedModPath(self)
107107
}
108108

109109
fn _fmt(&self, f: &mut fmt::Formatter<'_>, escaped: bool) -> fmt::Result {
@@ -145,13 +145,13 @@ impl ModPath {
145145

146146
impl Display for ModPath {
147147
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
148-
self._fmt(f, false)
148+
self._fmt(f, true)
149149
}
150150
}
151151

152-
impl<'a> Display for EscapedModPath<'a> {
152+
impl<'a> Display for UnescapedModPath<'a> {
153153
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
154-
self.0._fmt(f, true)
154+
self.0._fmt(f, false)
155155
}
156156
}
157157

crates/ide-completion/src/render/literal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fn render(
7373
None => (name.clone().into(), name.into(), false),
7474
};
7575
let (qualified_name, escaped_qualified_name) =
76-
(qualified_name.to_string(), qualified_name.escaped().to_string());
76+
(qualified_name.unescaped().to_string(), qualified_name.to_string());
7777
let snippet_cap = ctx.snippet_cap();
7878

7979
let mut rendered = match kind {

crates/ide-completion/src/render/pattern.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub(crate) fn render_variant_pat(
5353
let (visible_fields, fields_omitted) = visible_fields(ctx.completion, &fields, variant)?;
5454

5555
let (name, escaped_name) = match path {
56-
Some(path) => (path.to_string().into(), path.escaped().to_string().into()),
56+
Some(path) => (path.unescaped().to_string().into(), path.to_string().into()),
5757
None => {
5858
let name = local_name.unwrap_or_else(|| variant.name(ctx.db()));
5959
(name.unescaped().to_smol_str(), name.to_smol_str())

crates/ide-completion/src/render/union_literal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub(crate) fn render_union_literal(
2121
let name = local_name.unwrap_or_else(|| un.name(ctx.db()));
2222

2323
let (qualified_name, escaped_qualified_name) = match path {
24-
Some(p) => (p.to_string(), p.escaped().to_string()),
24+
Some(p) => (p.unescaped().to_string(), p.to_string()),
2525
None => (name.unescaped().to_string(), name.to_string()),
2626
};
2727

0 commit comments

Comments
 (0)