Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix unformatted error contexts (#52568)

Jakub Charvatc90bf6e6b7c0
diff --git a/crates/extension_host/src/headless_host.rs b/crates/extension_host/src/headless_host.rs
index 0aff06fdddc..7c30228257d 100644
--- a/crates/extension_host/src/headless_host.rs
+++ b/crates/extension_host/src/headless_host.rs
@@ -281,7 +281,7 @@ impl HeadlessExtensionStore {
fs.rename(&tmp_path, &path, RenameOptions::default())
.await
- .context("Failed to rename {tmp_path:?} to {path:?}")?;
+ .with_context(|| format!("Failed to rename {tmp_path:?} to {path:?}"))?;
Self::load_extension(this, extension, cx).await
})
diff --git a/crates/language_models/src/provider/bedrock.rs b/crates/language_models/src/provider/bedrock.rs
index 734e97ee335..f53f145dbd3 100644
--- a/crates/language_models/src/provider/bedrock.rs
+++ b/crates/language_models/src/provider/bedrock.rs
@@ -344,7 +344,7 @@ impl State {
.ok_or(AuthenticateError::CredentialsNotFound)?;
let credentials_str = String::from_utf8(credentials_bytes)
- .context("invalid {PROVIDER_NAME} credentials")?;
+ .with_context(|| format!("invalid {PROVIDER_NAME} credentials"))?;
let credentials: BedrockCredentials =
serde_json::from_str(&credentials_str).context("failed to parse credentials")?;
diff --git a/crates/project/src/lsp_command.rs b/crates/project/src/lsp_command.rs
index 59baaa156e6..d4a4f9b0496 100644
--- a/crates/project/src/lsp_command.rs
+++ b/crates/project/src/lsp_command.rs
@@ -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,