From 6833183ab45d5f0ad2e350d62c457eb8a4734b83 Mon Sep 17 00:00:00 2001 From: Diana <5275194+DianaNites@users.noreply.github.com> Date: Fri, 1 May 2020 11:49:41 -0400 Subject: Unsafe traits --- crates/ra_ide/src/display/short_label.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'crates/ra_ide/src') diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index 4b081bf6c..d37260e96 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs @@ -33,7 +33,11 @@ impl ShortLabel for ast::EnumDef { impl ShortLabel for ast::TraitDef { fn short_label(&self) -> Option { - short_label_from_node(self, "trait ") + if self.unsafe_token().is_some() { + short_label_from_node(self, "unsafe trait ") + } else { + short_label_from_node(self, "trait ") + } } } -- cgit v1.2.3 From ebff5762e9789ecd472564284994a9ac119b4166 Mon Sep 17 00:00:00 2001 From: Diana <5275194+DianaNites@users.noreply.github.com> Date: Fri, 1 May 2020 11:49:51 -0400 Subject: Test for unsafe trait --- crates/ra_ide/src/hover.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'crates/ra_ide/src') diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index a62f598f0..54d318858 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs @@ -869,4 +869,15 @@ fn func(foo: i32) { if true { <|>foo; }; } &[r#"pub(crate) async unsafe extern "C" fn foo()"#], ); } + + #[test] + fn test_hover_trait_show_qualifiers() { + check_hover_result( + " + //- /lib.rs + unsafe trait foo<|>() {} + ", + &["unsafe trait foo"], + ); + } } -- cgit v1.2.3