mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 09:27:27 +00:00
Address comments
This commit is contained in:
parent
b98c119ba6
commit
765ccf2eca
3 changed files with 25 additions and 3 deletions
|
@ -227,8 +227,8 @@ pub(super) fn element(
|
|||
k if k.is_keyword() => {
|
||||
let h = Highlight::new(HlTag::Keyword);
|
||||
match k {
|
||||
T![await]
|
||||
| T![break]
|
||||
T![await] => h | HlMod::Async | HlMod::ControlFlow,
|
||||
T![break]
|
||||
| T![continue]
|
||||
| T![else]
|
||||
| T![if]
|
||||
|
@ -255,7 +255,7 @@ pub(super) fn element(
|
|||
})
|
||||
.map(|modifier| h | modifier)
|
||||
.unwrap_or(h),
|
||||
T![async] | T![await] => h | HlMod::Async,
|
||||
T![async] => h | HlMod::Async,
|
||||
_ => h,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -234,4 +234,15 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
|
|||
<span class="variable declaration">Nope</span> <span class="operator">=></span> <span class="variable">Nope</span><span class="comma">,</span>
|
||||
<span class="brace">}</span>
|
||||
<span class="brace">}</span>
|
||||
<span class="brace">}</span>
|
||||
|
||||
<span class="keyword async">async</span> <span class="keyword">fn</span> <span class="function declaration async">learn_and_sing</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span>
|
||||
<span class="keyword">let</span> <span class="variable declaration">song</span> <span class="operator">=</span> <span class="unresolved_reference">learn_song</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="operator">.</span><span class="keyword control async">await</span><span class="semicolon">;</span>
|
||||
<span class="unresolved_reference">sing_song</span><span class="parenthesis">(</span><span class="variable consuming">song</span><span class="parenthesis">)</span><span class="operator">.</span><span class="keyword control async">await</span><span class="semicolon">;</span>
|
||||
<span class="brace">}</span>
|
||||
|
||||
<span class="keyword async">async</span> <span class="keyword">fn</span> <span class="function declaration async">async_main</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span>
|
||||
<span class="keyword">let</span> <span class="variable declaration">f1</span> <span class="operator">=</span> <span class="function async">learn_and_sing</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span>
|
||||
<span class="keyword">let</span> <span class="variable declaration">f2</span> <span class="operator">=</span> <span class="unresolved_reference">dance</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span>
|
||||
futures::<span class="macro">join!</span><span class="parenthesis">(</span>f1<span class="comma">,</span> f2<span class="parenthesis">)</span><span class="semicolon">;</span>
|
||||
<span class="brace">}</span></code></pre>
|
|
@ -208,6 +208,17 @@ impl<T> Option<T> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn learn_and_sing() {
|
||||
let song = learn_song().await;
|
||||
sing_song(song).await;
|
||||
}
|
||||
|
||||
async fn async_main() {
|
||||
let f1 = learn_and_sing();
|
||||
let f2 = dance();
|
||||
futures::join!(f1, f2);
|
||||
}
|
||||
"#
|
||||
.trim(),
|
||||
expect_file!["./test_data/highlighting.html"],
|
||||
|
|
Loading…
Reference in a new issue