diff --git a/Cargo.lock b/Cargo.lock index 96eda77abb279..a1bbc1dca766e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3021,7 +3021,6 @@ dependencies = [ name = "rls" version = "2.0.0" dependencies = [ - "serde", "serde_json", ] diff --git a/src/tools/rls/Cargo.toml b/src/tools/rls/Cargo.toml index b84647eb33272..b7aa659c25a94 100644 --- a/src/tools/rls/Cargo.toml +++ b/src/tools/rls/Cargo.toml @@ -5,5 +5,4 @@ edition = "2021" license = "Apache-2.0/MIT" [dependencies] -serde = { version = "1.0.143", features = ["derive"] } serde_json = "1.0.83" diff --git a/src/tools/rls/src/main.rs b/src/tools/rls/src/main.rs index f96f1325d9636..d7be108e89c00 100644 --- a/src/tools/rls/src/main.rs +++ b/src/tools/rls/src/main.rs @@ -3,7 +3,7 @@ //! This is a small stub that replaces RLS to alert the user that RLS is no //! longer available. -use serde::Deserialize; +use serde_json::Value; use std::error::Error; use std::io::BufRead; use std::io::Write; @@ -21,7 +21,6 @@ fn main() { } } -#[derive(Deserialize)] struct Message { method: Option, } @@ -88,8 +87,10 @@ fn read_message_raw(reader: &mut R) -> Result fn read_message(reader: &mut R) -> Result> { let m = read_message_raw(reader)?; - match serde_json::from_str(&m) { - Ok(m) => Ok(m), + match serde_json::from_str::(&m) { + Ok(message) => Ok(Message { + method: message.get("method").and_then(|value| value.as_str().map(String::from)), + }), Err(e) => Err(format!("failed to parse message {m}\n{e}").into()), } }