mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +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() => {
|
k if k.is_keyword() => {
|
||||||
let h = Highlight::new(HlTag::Keyword);
|
let h = Highlight::new(HlTag::Keyword);
|
||||||
match k {
|
match k {
|
||||||
T![await]
|
T![await] => h | HlMod::Async | HlMod::ControlFlow,
|
||||||
| T![break]
|
T![break]
|
||||||
| T![continue]
|
| T![continue]
|
||||||
| T![else]
|
| T![else]
|
||||||
| T![if]
|
| T![if]
|
||||||
|
@ -255,7 +255,7 @@ pub(super) fn element(
|
||||||
})
|
})
|
||||||
.map(|modifier| h | modifier)
|
.map(|modifier| h | modifier)
|
||||||
.unwrap_or(h),
|
.unwrap_or(h),
|
||||||
T![async] | T![await] => h | HlMod::Async,
|
T![async] => h | HlMod::Async,
|
||||||
_ => h,
|
_ => 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="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="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>
|
<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(),
|
.trim(),
|
||||||
expect_file!["./test_data/highlighting.html"],
|
expect_file!["./test_data/highlighting.html"],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue