When debugging a remote SSH connection, I came across an unformatted
format string in the output log. I changed the raw `.context(fmt)` call
to a `.with_context(|| format!(fmt))`. I ran a quick sweep through the
codebase to identify and fix two other instances of the same issue.
Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Release Notes:
- N/A
@@ -3215,8 +3215,9 @@ impl InlayHints {
Some(((uri, range), server_id)) => Some((
LanguageServerId(server_id as usize),
lsp::Location {
- uri: lsp::Uri::from_str(&uri)- .context("invalid uri in hint part {part:?}")?,
+ uri: lsp::Uri::from_str(&uri).with_context(|| {
+ format!("invalid uri in hint part {uri:?}")
+ })?,
range: lsp::Range::new(
point_to_lsp(PointUtf16::new(
range.start.row,