diff options
author | Aleksey Kladov <[email protected]> | 2020-07-30 19:51:43 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-07-30 19:51:43 +0100 |
commit | 2e2642efccd5855e4158b01a006e7884a96982bb (patch) | |
tree | de4342a453b3b504178dd17c46fab3e1d6e995d2 /crates/ra_ide/src/display | |
parent | fbe60a2e284035d16c2a1ee743ee88db418689aa (diff) |
Remove TypeAscriptionOwner
Diffstat (limited to 'crates/ra_ide/src/display')
-rw-r--r-- | crates/ra_ide/src/display/short_label.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index c600908a4..bddf1bd47 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use ra_syntax::ast::{self, AstNode, NameOwner, TypeAscriptionOwner, VisibilityOwner}; | 3 | use ra_syntax::ast::{self, AstNode, NameOwner, VisibilityOwner}; |
4 | use stdx::format_to; | 4 | use stdx::format_to; |
5 | 5 | ||
6 | pub(crate) trait ShortLabel { | 6 | pub(crate) trait ShortLabel { |
@@ -55,19 +55,19 @@ impl ShortLabel for ast::TypeAlias { | |||
55 | 55 | ||
56 | impl ShortLabel for ast::Const { | 56 | impl ShortLabel for ast::Const { |
57 | fn short_label(&self) -> Option<String> { | 57 | fn short_label(&self) -> Option<String> { |
58 | short_label_from_ascribed_node(self, "const ") | 58 | short_label_from_ty(self, self.ty(), "const ") |
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 | ||
62 | impl ShortLabel for ast::Static { | 62 | impl ShortLabel for ast::Static { |
63 | fn short_label(&self) -> Option<String> { | 63 | fn short_label(&self) -> Option<String> { |
64 | short_label_from_ascribed_node(self, "static ") | 64 | short_label_from_ty(self, self.ty(), "static ") |
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
68 | impl ShortLabel for ast::RecordField { | 68 | impl ShortLabel for ast::RecordField { |
69 | fn short_label(&self) -> Option<String> { | 69 | fn short_label(&self) -> Option<String> { |
70 | short_label_from_ascribed_node(self, "") | 70 | short_label_from_ty(self, self.ty(), "") |
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
@@ -77,13 +77,13 @@ impl ShortLabel for ast::Variant { | |||
77 | } | 77 | } |
78 | } | 78 | } |
79 | 79 | ||
80 | fn short_label_from_ascribed_node<T>(node: &T, prefix: &str) -> Option<String> | 80 | fn short_label_from_ty<T>(node: &T, ty: Option<ast::TypeRef>, prefix: &str) -> Option<String> |
81 | where | 81 | where |
82 | T: NameOwner + VisibilityOwner + TypeAscriptionOwner, | 82 | T: NameOwner + VisibilityOwner, |
83 | { | 83 | { |
84 | let mut buf = short_label_from_node(node, prefix)?; | 84 | let mut buf = short_label_from_node(node, prefix)?; |
85 | 85 | ||
86 | if let Some(type_ref) = node.ascribed_type() { | 86 | if let Some(type_ref) = ty { |
87 | format_to!(buf, ": {}", type_ref.syntax()); | 87 | format_to!(buf, ": {}", type_ref.syntax()); |
88 | } | 88 | } |
89 | 89 | ||