diff options
Diffstat (limited to 'crates/ra_ide/test_data/highlighting.html')
-rw-r--r-- | crates/ra_ide/test_data/highlighting.html | 160 |
1 files changed, 80 insertions, 80 deletions
diff --git a/crates/ra_ide/test_data/highlighting.html b/crates/ra_ide/test_data/highlighting.html index 553811a2f..767e82f9d 100644 --- a/crates/ra_ide/test_data/highlighting.html +++ b/crates/ra_ide/test_data/highlighting.html | |||
@@ -35,94 +35,94 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
35 | 35 | ||
36 | .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } | 36 | .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } |
37 | </style> | 37 | </style> |
38 | <pre><code><span class="attribute">#[</span><span class="function attribute">derive</span><span class="attribute">(Clone, Debug)]</span> | 38 | <pre><code><span class="punctuation">#</span><span class="punctuation">[</span><span class="function attribute">derive</span><span class="punctuation">(</span><span class="attribute">Clone</span><span class="punctuation">,</span><span class="attribute"> Debug</span><span class="punctuation">)</span><span class="punctuation">]</span> |
39 | <span class="keyword">struct</span> <span class="struct declaration">Foo</span> { | 39 | <span class="keyword">struct</span> <span class="struct declaration">Foo</span> <span class="punctuation">{</span> |
40 | <span class="keyword">pub</span> <span class="field declaration">x</span>: <span class="builtin_type">i32</span>, | 40 | <span class="keyword">pub</span> <span class="field declaration">x</span><span class="punctuation">:</span> <span class="builtin_type">i32</span><span class="punctuation">,</span> |
41 | <span class="keyword">pub</span> <span class="field declaration">y</span>: <span class="builtin_type">i32</span>, | 41 | <span class="keyword">pub</span> <span class="field declaration">y</span><span class="punctuation">:</span> <span class="builtin_type">i32</span><span class="punctuation">,</span> |
42 | } | 42 | <span class="punctuation">}</span> |
43 | 43 | ||
44 | <span class="keyword">trait</span> <span class="trait declaration">Bar</span> { | 44 | <span class="keyword">trait</span> <span class="trait declaration">Bar</span> <span class="punctuation">{</span> |
45 | <span class="keyword">fn</span> <span class="function declaration">bar</span>(&<span class="self_keyword">self</span>) -> <span class="builtin_type">i32</span>; | 45 | <span class="keyword">fn</span> <span class="function declaration">bar</span><span class="punctuation">(</span><span class="punctuation">&</span><span class="self_keyword">self</span><span class="punctuation">)</span> <span class="punctuation">-></span> <span class="builtin_type">i32</span><span class="punctuation">;</span> |
46 | } | 46 | <span class="punctuation">}</span> |
47 | 47 | ||
48 | <span class="keyword">impl</span> <span class="trait">Bar</span> <span class="keyword">for</span> <span class="struct">Foo</span> { | 48 | <span class="keyword">impl</span> <span class="trait">Bar</span> <span class="keyword">for</span> <span class="struct">Foo</span> <span class="punctuation">{</span> |
49 | <span class="keyword">fn</span> <span class="function declaration">bar</span>(&<span class="self_keyword">self</span>) -> <span class="builtin_type">i32</span> { | 49 | <span class="keyword">fn</span> <span class="function declaration">bar</span><span class="punctuation">(</span><span class="punctuation">&</span><span class="self_keyword">self</span><span class="punctuation">)</span> <span class="punctuation">-></span> <span class="builtin_type">i32</span> <span class="punctuation">{</span> |
50 | <span class="self_keyword">self</span>.<span class="field">x</span> | 50 | <span class="self_keyword">self</span><span class="punctuation">.</span><span class="field">x</span> |
51 | } | 51 | <span class="punctuation">}</span> |
52 | } | 52 | <span class="punctuation">}</span> |
53 | 53 | ||
54 | <span class="keyword">impl</span> <span class="struct">Foo</span> { | 54 | <span class="keyword">impl</span> <span class="struct">Foo</span> <span class="punctuation">{</span> |
55 | <span class="keyword">fn</span> <span class="function declaration">baz</span>(<span class="keyword">mut</span> <span class="self_keyword mutable">self</span>) -> <span class="builtin_type">i32</span> { | 55 | <span class="keyword">fn</span> <span class="function declaration">baz</span><span class="punctuation">(</span><span class="keyword">mut</span> <span class="self_keyword mutable">self</span><span class="punctuation">)</span> <span class="punctuation">-></span> <span class="builtin_type">i32</span> <span class="punctuation">{</span> |
56 | <span class="self_keyword">self</span>.<span class="field">x</span> | 56 | <span class="self_keyword">self</span><span class="punctuation">.</span><span class="field">x</span> |
57 | } | 57 | <span class="punctuation">}</span> |
58 | 58 | ||
59 | <span class="keyword">fn</span> <span class="function declaration">qux</span>(&<span class="keyword">mut</span> <span class="self_keyword mutable">self</span>) { | 59 | <span class="keyword">fn</span> <span class="function declaration">qux</span><span class="punctuation">(</span><span class="punctuation">&</span><span class="keyword">mut</span> <span class="self_keyword mutable">self</span><span class="punctuation">)</span> <span class="punctuation">{</span> |
60 | <span class="self_keyword mutable">self</span>.<span class="field">x</span> = <span class="numeric_literal">0</span>; | 60 | <span class="self_keyword mutable">self</span><span class="punctuation">.</span><span class="field">x</span> <span class="punctuation">=</span> <span class="numeric_literal">0</span><span class="punctuation">;</span> |
61 | } | 61 | <span class="punctuation">}</span> |
62 | } | 62 | <span class="punctuation">}</span> |
63 | 63 | ||
64 | <span class="keyword">static</span> <span class="keyword">mut</span> <span class="static declaration mutable">STATIC_MUT</span>: <span class="builtin_type">i32</span> = <span class="numeric_literal">0</span>; | 64 | <span class="keyword">static</span> <span class="keyword">mut</span> <span class="static declaration mutable">STATIC_MUT</span><span class="punctuation">:</span> <span class="builtin_type">i32</span> <span class="punctuation">=</span> <span class="numeric_literal">0</span><span class="punctuation">;</span> |
65 | 65 | ||
66 | <span class="keyword">fn</span> <span class="function declaration">foo</span><<span class="lifetime declaration">'a</span>, <span class="type_param declaration">T</span>>() -> <span class="type_param">T</span> { | 66 | <span class="keyword">fn</span> <span class="function declaration">foo</span><span class="punctuation"><</span><span class="lifetime declaration">'a</span><span class="punctuation">,</span> <span class="type_param declaration">T</span><span class="punctuation">></span><span class="punctuation">(</span><span class="punctuation">)</span> <span class="punctuation">-></span> <span class="type_param">T</span> <span class="punctuation">{</span> |
67 | <span class="function">foo</span>::<<span class="lifetime">'a</span>, <span class="builtin_type">i32</span>>() | 67 | <span class="function">foo</span><span class="punctuation">::</span><span class="punctuation"><</span><span class="lifetime">'a</span><span class="punctuation">,</span> <span class="builtin_type">i32</span><span class="punctuation">></span><span class="punctuation">(</span><span class="punctuation">)</span> |
68 | } | 68 | <span class="punctuation">}</span> |
69 | 69 | ||
70 | <span class="macro">macro_rules!</span> <span class="macro declaration">def_fn</span> { | 70 | <span class="macro">macro_rules!</span> <span class="macro declaration">def_fn</span> <span class="punctuation">{</span> |
71 | ($($tt:tt)*) => {$($tt)*} | 71 | <span class="punctuation">(</span><span class="punctuation">$</span><span class="punctuation">(</span><span class="punctuation">$</span>tt<span class="punctuation">:</span>tt<span class="punctuation">)</span>*<span class="punctuation">)</span> <span class="punctuation">=</span><span class="punctuation">></span> <span class="punctuation">{</span><span class="punctuation">$</span><span class="punctuation">(</span><span class="punctuation">$</span>tt<span class="punctuation">)</span>*<span class="punctuation">}</span> |
72 | } | 72 | <span class="punctuation">}</span> |
73 | 73 | ||
74 | <span class="macro">def_fn!</span> { | 74 | <span class="macro">def_fn!</span> <span class="punctuation">{</span> |
75 | <span class="keyword">fn</span> <span class="function declaration">bar</span>() -> <span class="builtin_type">u32</span> { | 75 | <span class="keyword">fn</span> <span class="function declaration">bar</span><span class="punctuation">(</span><span class="punctuation">)</span> <span class="punctuation">-</span><span class="punctuation">></span> <span class="builtin_type">u32</span> <span class="punctuation">{</span> |
76 | <span class="numeric_literal">100</span> | 76 | <span class="numeric_literal">100</span> |
77 | } | 77 | <span class="punctuation">}</span> |
78 | } | 78 | <span class="punctuation">}</span> |
79 | 79 | ||
80 | <span class="macro">macro_rules!</span> <span class="macro declaration">noop</span> { | 80 | <span class="macro">macro_rules!</span> <span class="macro declaration">noop</span> <span class="punctuation">{</span> |
81 | ($expr:expr) => { | 81 | <span class="punctuation">(</span><span class="punctuation">$</span>expr<span class="punctuation">:</span>expr<span class="punctuation">)</span> <span class="punctuation">=</span><span class="punctuation">></span> <span class="punctuation">{</span> |
82 | $expr | 82 | <span class="punctuation">$</span>expr |
83 | } | 83 | <span class="punctuation">}</span> |
84 | } | 84 | <span class="punctuation">}</span> |
85 | 85 | ||
86 | <span class="comment">// comment</span> | 86 | <span class="comment">// comment</span> |
87 | <span class="keyword">fn</span> <span class="function declaration">main</span>() { | 87 | <span class="keyword">fn</span> <span class="function declaration">main</span><span class="punctuation">(</span><span class="punctuation">)</span> <span class="punctuation">{</span> |
88 | <span class="macro">println!</span>(<span class="string_literal">"Hello, {}!"</span>, <span class="numeric_literal">92</span>); | 88 | <span class="macro">println!</span><span class="punctuation">(</span><span class="string_literal">"Hello, {}!"</span><span class="punctuation">,</span> <span class="numeric_literal">92</span><span class="punctuation">)</span><span class="punctuation">;</span> |
89 | 89 | ||
90 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">vec</span> = <span class="unresolved_reference">Vec</span>::<span class="unresolved_reference">new</span>(); | 90 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">vec</span> <span class="punctuation">=</span> <span class="unresolved_reference">Vec</span><span class="punctuation">::</span><span class="unresolved_reference">new</span><span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">;</span> |
91 | <span class="keyword control">if</span> <span class="bool_literal">true</span> { | 91 | <span class="keyword control">if</span> <span class="bool_literal">true</span> <span class="punctuation">{</span> |
92 | <span class="keyword">let</span> <span class="variable declaration">x</span> = <span class="numeric_literal">92</span>; | 92 | <span class="keyword">let</span> <span class="variable declaration">x</span> <span class="punctuation">=</span> <span class="numeric_literal">92</span><span class="punctuation">;</span> |
93 | <span class="variable mutable">vec</span>.<span class="unresolved_reference">push</span>(<span class="struct">Foo</span> { <span class="field">x</span>, <span class="field">y</span>: <span class="numeric_literal">1</span> }); | 93 | <span class="variable mutable">vec</span><span class="punctuation">.</span><span class="unresolved_reference">push</span><span class="punctuation">(</span><span class="struct">Foo</span> <span class="punctuation">{</span> <span class="field">x</span><span class="punctuation">,</span> <span class="field">y</span><span class="punctuation">:</span> <span class="numeric_literal">1</span> <span class="punctuation">}</span><span class="punctuation">)</span><span class="punctuation">;</span> |
94 | } | 94 | <span class="punctuation">}</span> |
95 | <span class="keyword unsafe">unsafe</span> { | 95 | <span class="keyword unsafe">unsafe</span> <span class="punctuation">{</span> |
96 | <span class="variable mutable">vec</span>.<span class="unresolved_reference">set_len</span>(<span class="numeric_literal">0</span>); | 96 | <span class="variable mutable">vec</span><span class="punctuation">.</span><span class="unresolved_reference">set_len</span><span class="punctuation">(</span><span class="numeric_literal">0</span><span class="punctuation">)</span><span class="punctuation">;</span> |
97 | <span class="static mutable">STATIC_MUT</span> = <span class="numeric_literal">1</span>; | 97 | <span class="static mutable">STATIC_MUT</span> <span class="punctuation">=</span> <span class="numeric_literal">1</span><span class="punctuation">;</span> |
98 | } | 98 | <span class="punctuation">}</span> |
99 | 99 | ||
100 | <span class="keyword control">for</span> <span class="variable declaration">e</span> <span class="keyword control">in</span> <span class="variable mutable">vec</span> { | 100 | <span class="keyword control">for</span> <span class="variable declaration">e</span> <span class="keyword control">in</span> <span class="variable mutable">vec</span> <span class="punctuation">{</span> |
101 | <span class="comment">// Do nothing</span> | 101 | <span class="comment">// Do nothing</span> |
102 | } | 102 | <span class="punctuation">}</span> |
103 | 103 | ||
104 | <span class="macro">noop!</span>(<span class="macro">noop</span><span class="macro">!</span>(<span class="numeric_literal">1</span>)); | 104 | <span class="macro">noop!</span><span class="punctuation">(</span><span class="macro">noop</span><span class="macro">!</span><span class="punctuation">(</span><span class="numeric_literal">1</span><span class="punctuation">)</span><span class="punctuation">)</span><span class="punctuation">;</span> |
105 | 105 | ||
106 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">x</span> = <span class="numeric_literal">42</span>; | 106 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">x</span> <span class="punctuation">=</span> <span class="numeric_literal">42</span><span class="punctuation">;</span> |
107 | <span class="keyword">let</span> <span class="variable declaration mutable">y</span> = &<span class="keyword">mut</span> <span class="variable mutable">x</span>; | 107 | <span class="keyword">let</span> <span class="variable declaration mutable">y</span> <span class="punctuation">=</span> <span class="punctuation">&</span><span class="keyword">mut</span> <span class="variable mutable">x</span><span class="punctuation">;</span> |
108 | <span class="keyword">let</span> <span class="variable declaration">z</span> = &<span class="variable mutable">y</span>; | 108 | <span class="keyword">let</span> <span class="variable declaration">z</span> <span class="punctuation">=</span> <span class="punctuation">&</span><span class="variable mutable">y</span><span class="punctuation">;</span> |
109 | 109 | ||
110 | <span class="keyword">let</span> <span class="struct">Foo</span> { <span class="field">x</span>: <span class="variable declaration">z</span>, <span class="field">y</span> } = <span class="struct">Foo</span> { <span class="field">x</span>: <span class="variable">z</span>, <span class="field">y</span> }; | 110 | <span class="keyword">let</span> <span class="struct">Foo</span> <span class="punctuation">{</span> <span class="field">x</span><span class="punctuation">:</span> <span class="variable declaration">z</span><span class="punctuation">,</span> <span class="field">y</span> <span class="punctuation">}</span> <span class="punctuation">=</span> <span class="struct">Foo</span> <span class="punctuation">{</span> <span class="field">x</span><span class="punctuation">:</span> <span class="variable">z</span><span class="punctuation">,</span> <span class="field">y</span> <span class="punctuation">}</span><span class="punctuation">;</span> |
111 | 111 | ||
112 | <span class="variable">y</span>; | 112 | <span class="variable">y</span><span class="punctuation">;</span> |
113 | } | 113 | <span class="punctuation">}</span> |
114 | 114 | ||
115 | <span class="keyword">enum</span> <span class="enum declaration">Option</span><<span class="type_param declaration">T</span>> { | 115 | <span class="keyword">enum</span> <span class="enum declaration">Option</span><span class="punctuation"><</span><span class="type_param declaration">T</span><span class="punctuation">></span> <span class="punctuation">{</span> |
116 | <span class="enum_variant declaration">Some</span>(<span class="type_param">T</span>), | 116 | <span class="enum_variant declaration">Some</span><span class="punctuation">(</span><span class="type_param">T</span><span class="punctuation">)</span><span class="punctuation">,</span> |
117 | <span class="enum_variant declaration">None</span>, | 117 | <span class="enum_variant declaration">None</span><span class="punctuation">,</span> |
118 | } | 118 | <span class="punctuation">}</span> |
119 | <span class="keyword">use</span> <span class="enum">Option</span>::*; | 119 | <span class="keyword">use</span> <span class="enum">Option</span><span class="punctuation">::</span>*<span class="punctuation">;</span> |
120 | 120 | ||
121 | <span class="keyword">impl</span><<span class="type_param declaration">T</span>> <span class="enum">Option</span><<span class="type_param">T</span>> { | 121 | <span class="keyword">impl</span><span class="punctuation"><</span><span class="type_param declaration">T</span><span class="punctuation">></span> <span class="enum">Option</span><span class="punctuation"><</span><span class="type_param">T</span><span class="punctuation">></span> <span class="punctuation">{</span> |
122 | <span class="keyword">fn</span> <span class="function declaration">and</span><<span class="type_param declaration">U</span>>(<span class="self_keyword">self</span>, <span class="value_param declaration">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>)> { | 122 | <span class="keyword">fn</span> <span class="function declaration">and</span><span class="punctuation"><</span><span class="type_param declaration">U</span><span class="punctuation">></span><span class="punctuation">(</span><span class="self_keyword">self</span><span class="punctuation">,</span> <span class="value_param declaration">other</span><span class="punctuation">:</span> <span class="enum">Option</span><span class="punctuation"><</span><span class="type_param">U</span><span class="punctuation">></span><span class="punctuation">)</span> <span class="punctuation">-></span> <span class="enum">Option</span><span class="punctuation"><</span><span class="punctuation">(</span><span class="type_param">T</span><span class="punctuation">,</span> <span class="type_param">U</span><span class="punctuation">)</span><span class="punctuation">></span> <span class="punctuation">{</span> |
123 | <span class="keyword control">match</span> <span class="value_param">other</span> { | 123 | <span class="keyword control">match</span> <span class="value_param">other</span> <span class="punctuation">{</span> |
124 | <span class="enum_variant">None</span> => <span class="macro">unimplemented!</span>(), | 124 | <span class="enum_variant">None</span> <span class="punctuation">=></span> <span class="macro">unimplemented!</span><span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">,</span> |
125 | <span class="variable declaration">Nope</span> => <span class="variable">Nope</span>, | 125 | <span class="variable declaration">Nope</span> <span class="punctuation">=></span> <span class="variable">Nope</span><span class="punctuation">,</span> |
126 | } | 126 | <span class="punctuation">}</span> |
127 | } | 127 | <span class="punctuation">}</span> |
128 | }</code></pre> \ No newline at end of file | 128 | <span class="punctuation">}</span></code></pre> \ No newline at end of file |