aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-02-28 15:36:14 +0000
committerAleksey Kladov <[email protected]>2020-02-28 15:38:36 +0000
commit5ebfcb9cb757ece936f631cf69136e1d38cb6afc (patch)
tree2fe6a843fb15a62e3177b473e99118778619ca39 /crates/ra_ide/src
parent209eb32796c6fd56d1b378690c807cf73ce54235 (diff)
Fix highlighting of const patterns
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/snapshots/highlighting.html15
-rw-r--r--crates/ra_ide/src/syntax_highlighting/tests.rs17
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>&lt;<span class="type_param">X</span>&gt; { 68<span class="keyword">enum</span> <span class="enum">Option</span>&lt;<span class="type_param">T</span>&gt; {
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>&lt;<span class="type_param">X</span>&gt; <span class="enum">E</span>&lt;<span class="type_param">X</span>&gt; { 74<span class="keyword">impl</span>&lt;<span class="type_param">T</span>&gt; <span class="enum">Option</span>&lt;<span class="type_param">T</span>&gt; {
73 <span class="keyword">fn</span> <span class="function">new</span>&lt;<span class="type_param">T</span>&gt;() -&gt; <span class="enum">E</span>&lt;<span class="type_param">T</span>&gt; {} 75 <span class="keyword">fn</span> <span class="function">and</span>&lt;<span class="type_param">U</span>&gt;(<span class="keyword">self</span>, <span class="variable">other</span>: <span class="enum">Option</span>&lt;<span class="type_param">U</span>&gt;) -&gt; <span class="enum">Option</span>&lt;(<span class="type_param">T</span>, <span class="type_param">U</span>)&gt; {
76 <span class="keyword control">match</span> <span class="variable">other</span> {
77 <span class="enum_variant">None</span> =&gt; <span class="macro">todo</span><span class="macro">!</span>(),
78 <span class="variable">Nope</span> =&gt; <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
53enum E<X> { 53enum Option<T> {
54 V(X) 54 Some(T),
55 None,
55} 56}
56 57use Option::*;
57impl<X> E<X> { 58
58 fn new<T>() -> E<T> {} 59impl<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(),