From 2e2642efccd5855e4158b01a006e7884a96982bb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 20:51:43 +0200 Subject: Remove TypeAscriptionOwner --- crates/ra_ide/src/display/short_label.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'crates/ra_ide/src/display') 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 @@ //! FIXME: write short doc here -use ra_syntax::ast::{self, AstNode, NameOwner, TypeAscriptionOwner, VisibilityOwner}; +use ra_syntax::ast::{self, AstNode, NameOwner, VisibilityOwner}; use stdx::format_to; pub(crate) trait ShortLabel { @@ -55,19 +55,19 @@ impl ShortLabel for ast::TypeAlias { impl ShortLabel for ast::Const { fn short_label(&self) -> Option { - short_label_from_ascribed_node(self, "const ") + short_label_from_ty(self, self.ty(), "const ") } } impl ShortLabel for ast::Static { fn short_label(&self) -> Option { - short_label_from_ascribed_node(self, "static ") + short_label_from_ty(self, self.ty(), "static ") } } impl ShortLabel for ast::RecordField { fn short_label(&self) -> Option { - short_label_from_ascribed_node(self, "") + short_label_from_ty(self, self.ty(), "") } } @@ -77,13 +77,13 @@ impl ShortLabel for ast::Variant { } } -fn short_label_from_ascribed_node(node: &T, prefix: &str) -> Option +fn short_label_from_ty(node: &T, ty: Option, prefix: &str) -> Option where - T: NameOwner + VisibilityOwner + TypeAscriptionOwner, + T: NameOwner + VisibilityOwner, { let mut buf = short_label_from_node(node, prefix)?; - if let Some(type_ref) = node.ascribed_type() { + if let Some(type_ref) = ty { format_to!(buf, ": {}", type_ref.syntax()); } -- cgit v1.2.3