ZIm/crates/git_ui/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
..
askpass_modal.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
blame_ui.rs editor: Move blame popover from hover_tooltip to editor prepaint (#29320) 2025-04-25 01:52:24 +05:30
branch_picker.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
commit_message_prompt.txt git_ui: Try to prompt the model out of including the diff output (#26281) 2025-03-07 15:05:35 +00:00
commit_modal.rs Improve handling of remote-tracking branches in the picker (#29744) 2025-05-01 21:24:26 -04:00
commit_tooltip.rs editor: Move blame popover from hover_tooltip to editor prepaint (#29320) 2025-04-25 01:52:24 +05:30
commit_view.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
conflict_view.rs git: Save buffer when resolving a conflict from the project diff (#30762) 2025-05-19 17:32:31 +00:00
git_panel.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
git_panel_settings.rs Git tweaks (#28791) 2025-04-28 23:42:23 -06:00
git_ui.rs git_ui: Fix resetting of onboarding banner (#30051) 2025-05-06 23:20:37 +00:00
onboarding.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
picker_prompt.rs chore: Bump Rust version to 1.86 (#28021) 2025-04-03 23:32:50 +02:00
project_diff.rs git: Save buffer when resolving a conflict from the project diff (#30762) 2025-05-19 17:32:31 +00:00
remote_output.rs Fix message on push (#26588) 2025-03-12 20:18:28 +00:00
repository_selector.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00