ZIm/crates/language/src
Kirill Bulatov 16366cf9f2
Use anyhow more idiomatically (#31052)
https://github.com/zed-industries/zed/issues/30972 brought up another
case where our context is not enough to track the actual source of the
issue: we get a general top-level error without inner error.

The reason for this was `.ok_or_else(|| anyhow!("failed to read HEAD
SHA"))?; ` on the top level.

The PR finally reworks the way we use anyhow to reduce such issues (or
at least make it simpler to bubble them up later in a fix).
On top of that, uses a few more anyhow methods for better readability.

* `.ok_or_else(|| anyhow!("..."))`, `map_err` and other similar error
conversion/option reporting cases are replaced with `context` and
`with_context` calls
* in addition to that, various `anyhow!("failed to do ...")` are
stripped with `.context("Doing ...")` messages instead to remove the
parasitic `failed to` text
* `anyhow::ensure!` is used instead of `if ... { return Err(...); }`
calls
* `anyhow::bail!` is used instead of `return Err(anyhow!(...));`

Release Notes:

- N/A
2025-05-20 23:06:07 +00:00
..
syntax_map chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
buffer.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
buffer_tests.rs language: Fix language_scope_at for markdown code comments (#29230) 2025-04-23 01:20:25 +05:30
diagnostic_set.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
highlight_map.rs Docs for indent_size_for_line and co 2024-01-09 20:50:34 +01:00
language.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
language_registry.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
language_settings.rs debugger: Fix nits (#30632) 2025-05-13 23:13:02 +02:00
manifest.rs project: Track manifest locations per unique manifest locator (#27194) 2025-03-21 15:22:36 +01:00
outline.rs Fix panic when outline items have no name (#24574) 2025-02-10 18:50:26 +00:00
proto.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
syntax_map.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
task_context.rs debugger: Rework language association with the debuggers (#29945) 2025-05-06 20:16:41 +02:00
text_diff.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
toolchain.rs extension: Add debug_adapters to extension manifest (#30676) 2025-05-20 11:01:33 +02:00