diff options
author | Aleksey Kladov <[email protected]> | 2020-02-28 15:36:14 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-02-28 15:38:36 +0000 |
commit | 5ebfcb9cb757ece936f631cf69136e1d38cb6afc (patch) | |
tree | 2fe6a843fb15a62e3177b473e99118778619ca39 /crates/ra_ide/src | |
parent | 209eb32796c6fd56d1b378690c807cf73ce54235 (diff) |
Fix highlighting of const patterns
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/snapshots/highlighting.html | 15 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting/tests.rs | 17 |
2 files changed, 23 insertions, 9 deletions
diff --git a/crates/ra_ide/src/snapshots/highlighting.html b/crates/ra_ide/src/snapshots/highlighting.html index 8c372ad27..cb4097e05 100644 --- a/crates/ra_ide/src/snapshots/highlighting.html +++ b/crates/ra_ide/src/snapshots/highlighting.html | |||
@@ -65,10 +65,17 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
65 | <span class="variable mutable">y</span>; | 65 | <span class="variable mutable">y</span>; |
66 | } | 66 | } |
67 | 67 | ||
68 | <span class="keyword">enum</span> <span class="enum">E</span><<span class="type_param">X</span>> { | 68 | <span class="keyword">enum</span> <span class="enum">Option</span><<span class="type_param">T</span>> { |
69 | <span class="enum_variant">V</span>(<span class="type_param">X</span>) | 69 | <span class="enum_variant">Some</span>(<span class="type_param">T</span>), |
70 | <span class="enum_variant">None</span>, | ||
70 | } | 71 | } |
72 | <span class="keyword">use</span> <span class="enum">Option</span>::*; | ||
71 | 73 | ||
72 | <span class="keyword">impl</span><<span class="type_param">X</span>> <span class="enum">E</span><<span class="type_param">X</span>> { | 74 | <span class="keyword">impl</span><<span class="type_param">T</span>> <span class="enum">Option</span><<span class="type_param">T</span>> { |
73 | <span class="keyword">fn</span> <span class="function">new</span><<span class="type_param">T</span>>() -> <span class="enum">E</span><<span class="type_param">T</span>> {} | 75 | <span class="keyword">fn</span> <span class="function">and</span><<span class="type_param">U</span>>(<span class="keyword">self</span>, <span class="variable">other</span>: <span class="enum">Option</span><<span class="type_param">U</span>>) -> <span class="enum">Option</span><(<span class="type_param">T</span>, <span class="type_param">U</span>)> { |
76 | <span class="keyword control">match</span> <span class="variable">other</span> { | ||
77 | <span class="enum_variant">None</span> => <span class="macro">todo</span><span class="macro">!</span>(), | ||
78 | <span class="variable">Nope</span> => <span class="variable">Nope</span>, | ||
79 | } | ||
80 | } | ||
74 | }</code></pre> \ No newline at end of file | 81 | }</code></pre> \ No newline at end of file |
diff --git a/crates/ra_ide/src/syntax_highlighting/tests.rs b/crates/ra_ide/src/syntax_highlighting/tests.rs index 2d90a072f..21c4dd818 100644 --- a/crates/ra_ide/src/syntax_highlighting/tests.rs +++ b/crates/ra_ide/src/syntax_highlighting/tests.rs | |||
@@ -50,12 +50,19 @@ fn main() { | |||
50 | y; | 50 | y; |
51 | } | 51 | } |
52 | 52 | ||
53 | enum E<X> { | 53 | enum Option<T> { |
54 | V(X) | 54 | Some(T), |
55 | None, | ||
55 | } | 56 | } |
56 | 57 | use Option::*; | |
57 | impl<X> E<X> { | 58 | |
58 | fn new<T>() -> E<T> {} | 59 | impl<T> Option<T> { |
60 | fn and<U>(self, other: Option<U>) -> Option<(T, U)> { | ||
61 | match other { | ||
62 | None => todo!(), | ||
63 | Nope => Nope, | ||
64 | } | ||
65 | } | ||
59 | } | 66 | } |
60 | "# | 67 | "# |
61 | .trim(), | 68 | .trim(), |