mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Auto merge of #17791 - ShoyuVanilla:await-outside-of-async, r=Veykril
feat: Implement diagnostic for `await` outside of `async` Closes #17781
This commit is contained in:
commit
25d9e05c03
6 changed files with 187 additions and 17 deletions
|
@ -24,6 +24,7 @@
|
|||
//! don't yet have a great pattern for how to do them properly.
|
||||
|
||||
mod handlers {
|
||||
pub(crate) mod await_outside_of_async;
|
||||
pub(crate) mod break_outside_of_loop;
|
||||
pub(crate) mod expected_function;
|
||||
pub(crate) mod inactive_code;
|
||||
|
@ -379,6 +380,7 @@ pub fn semantic_diagnostics(
|
|||
|
||||
for diag in diags {
|
||||
let d = match diag {
|
||||
AnyDiagnostic::AwaitOutsideOfAsync(d) => handlers::await_outside_of_async::await_outside_of_async(&ctx, &d),
|
||||
AnyDiagnostic::ExpectedFunction(d) => handlers::expected_function::expected_function(&ctx, &d),
|
||||
AnyDiagnostic::InactiveCode(d) => match handlers::inactive_code::inactive_code(&ctx, &d) {
|
||||
Some(it) => it,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue