diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-20 11:08:00 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-20 11:08:00 +0000 |
commit | b28c903b18d8bd9b2010d6e3466d4f903fa0ba67 (patch) | |
tree | c73e213a5a1a2b7a344d7f5860edfd9531dfb65d /crates/ide/src/display | |
parent | 63f509f4924e7448b9131514bbdd7a4da5292cd1 (diff) | |
parent | 3429b32ad119756985e1a7bfa5e9e53042671f8b (diff) |
Merge #7355
7355: :arrow_up: rowan r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ide/src/display')
-rw-r--r-- | crates/ide/src/display/navigation_target.rs | 3 | ||||
-rw-r--r-- | crates/ide/src/display/short_label.rs | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs index 00e601244..671aa1373 100644 --- a/crates/ide/src/display/navigation_target.rs +++ b/crates/ide/src/display/navigation_target.rs | |||
@@ -153,8 +153,7 @@ impl NavigationTarget { | |||
153 | node: InFile<&dyn ast::NameOwner>, | 153 | node: InFile<&dyn ast::NameOwner>, |
154 | kind: SymbolKind, | 154 | kind: SymbolKind, |
155 | ) -> NavigationTarget { | 155 | ) -> NavigationTarget { |
156 | let name = | 156 | let name = node.value.name().map(|it| it.text().into()).unwrap_or_else(|| "_".into()); |
157 | node.value.name().map(|it| it.text().clone()).unwrap_or_else(|| SmolStr::new("_")); | ||
158 | let focus_range = | 157 | let focus_range = |
159 | node.value.name().map(|it| node.with_value(it.syntax()).original_file_range(db).range); | 158 | node.value.name().map(|it| node.with_value(it.syntax()).original_file_range(db).range); |
160 | let frange = node.map(|it| it.syntax()).original_file_range(db); | 159 | let frange = node.map(|it| it.syntax()).original_file_range(db); |
diff --git a/crates/ide/src/display/short_label.rs b/crates/ide/src/display/short_label.rs index 990f740b8..b8e4cc181 100644 --- a/crates/ide/src/display/short_label.rs +++ b/crates/ide/src/display/short_label.rs | |||
@@ -90,7 +90,7 @@ impl ShortLabel for ast::Variant { | |||
90 | impl ShortLabel for ast::ConstParam { | 90 | impl ShortLabel for ast::ConstParam { |
91 | fn short_label(&self) -> Option<String> { | 91 | fn short_label(&self) -> Option<String> { |
92 | let mut buf = "const ".to_owned(); | 92 | let mut buf = "const ".to_owned(); |
93 | buf.push_str(self.name()?.text().as_str()); | 93 | buf.push_str(self.name()?.text()); |
94 | if let Some(type_ref) = self.ty() { | 94 | if let Some(type_ref) = self.ty() { |
95 | format_to!(buf, ": {}", type_ref.syntax()); | 95 | format_to!(buf, ": {}", type_ref.syntax()); |
96 | } | 96 | } |
@@ -117,6 +117,6 @@ where | |||
117 | { | 117 | { |
118 | let mut buf = node.visibility().map(|v| format!("{} ", v.syntax())).unwrap_or_default(); | 118 | let mut buf = node.visibility().map(|v| format!("{} ", v.syntax())).unwrap_or_default(); |
119 | buf.push_str(label); | 119 | buf.push_str(label); |
120 | buf.push_str(node.name()?.text().as_str()); | 120 | buf.push_str(node.name()?.text()); |
121 | Some(buf) | 121 | Some(buf) |
122 | } | 122 | } |