Skip to content

Commit b7dfd57

Browse files
Undinyopox
authored andcommitted
Render negative impls properly
1 parent 2e9406c commit b7dfd57

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/main/kotlin/org/rust/ide/presentation/Utils.kt

+3
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ private fun presentableName(psi: RsElement): String? {
7474
val trait = psi.traitRef?.text
7575
buildString {
7676
if (trait != null) {
77+
if (psi.isNegativeImpl) {
78+
append("!")
79+
}
7780
append("$trait for ")
7881
}
7982
append(type)

src/test/kotlin/org/rust/ide/lineMarkers/RsImplsLineMarkerProviderTest.kt

+9
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,23 @@ class RsImplsLineMarkerProviderTest : RsLineMarkerProviderTestBase() {
5050
impl Foo for Bar {}
5151
""")
5252

53+
fun `test negative impls`() = doPopupTest("""
54+
trait Foo {}
55+
struct Bar/*caret*/;
56+
impl !Foo for Bar {}
57+
""", "!Foo for Bar")
58+
5359
fun `test impls sorting`() = doPopupTest("""
5460
trait Bar {}
5561
trait Foo {}
62+
trait Baz {}
5663
struct FooBar/*caret*/;
5764
5865
impl Foo for FooBar {}
5966
impl Bar for FooBar {}
67+
impl !Baz for FooBar {}
6068
""",
69+
"!Baz for FooBar",
6170
"Bar for FooBar",
6271
"Foo for FooBar"
6372
)

0 commit comments

Comments
 (0)