Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/rust-analyzer/src/lib.rs')
-rw-r--r--crates/rust-analyzer/src/lib.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/crates/rust-analyzer/src/lib.rs b/crates/rust-analyzer/src/lib.rs
index 65de4366e9..57e26c241b 100644
--- a/crates/rust-analyzer/src/lib.rs
+++ b/crates/rust-analyzer/src/lib.rs
@@ -54,13 +54,12 @@ use serde::de::DeserializeOwned;
pub use crate::{caps::server_capabilities, main_loop::main_loop, version::version};
-pub type Error = Box<dyn std::error::Error + Send + Sync>;
-pub type Result<T, E = Error> = std::result::Result<T, E>;
-
-pub fn from_json<T: DeserializeOwned>(what: &'static str, json: &serde_json::Value) -> Result<T> {
- let res = serde_json::from_value(json.clone())
- .map_err(|e| format!("Failed to deserialize {what}: {e}; {json}"))?;
- Ok(res)
+pub fn from_json<T: DeserializeOwned>(
+ what: &'static str,
+ json: &serde_json::Value,
+) -> anyhow::Result<T> {
+ serde_json::from_value(json.clone())
+ .map_err(|e| anyhow::format_err!("Failed to deserialize {what}: {e}; {json}"))
}
#[derive(Debug)]