Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit ad4f303

Browse files
Rollup merge of rust-lang#113556 - cuviper:trim-rls, r=Mark-Simulacrum
Don't use serde-derive in the rls shim The already-small RLS shim can get a little smaller, and faster to build, if we drop the serde-derive dependency and decode the one "method" field it needs manually from `serde_json::Value`.
2 parents 40b1c5b + dd5fa7d commit ad4f303

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

‎Cargo.lock‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3021,7 +3021,6 @@ dependencies = [
30213021
name = "rls"
30223022
version = "2.0.0"
30233023
dependencies = [
3024-
"serde",
30253024
"serde_json",
30263025
]
30273026

‎src/tools/rls/Cargo.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ edition = "2021"
55
license = "Apache-2.0/MIT"
66

77
[dependencies]
8-
serde = { version = "1.0.143", features = ["derive"] }
98
serde_json = "1.0.83"

‎src/tools/rls/src/main.rs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! This is a small stub that replaces RLS to alert the user that RLS is no
44
//! longer available.
55
6-
use serde::Deserialize;
6+
use serde_json::Value;
77
use std::error::Error;
88
use std::io::BufRead;
99
use std::io::Write;
@@ -21,7 +21,6 @@ fn main() {
2121
}
2222
}
2323

24-
#[derive(Deserialize)]
2524
struct Message {
2625
method: Option<String>,
2726
}
@@ -88,8 +87,10 @@ fn read_message_raw<R: BufRead>(reader: &mut R) -> Result<String, Box<dyn Error>
8887

8988
fn read_message<R: BufRead>(reader: &mut R) -> Result<Message, Box<dyn Error>> {
9089
let m = read_message_raw(reader)?;
91-
match serde_json::from_str(&m) {
92-
Ok(m) => Ok(m),
90+
match serde_json::from_str::<Value>(&m) {
91+
Ok(message) => Ok(Message {
92+
method: message.get("method").and_then(|value| value.as_str().map(String::from)),
93+
}),
9394
Err(e) => Err(format!("failed to parse message {m}\n{e}").into()),
9495
}
9596
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /