mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-01 12:24:29 +00:00
internal: Split serde derive feature into serde_derive usage
Ideally we'd not have any dependency pull in the derive feature for faster build times, once that is the case this change would have an actual effect. See https://github.com/matklad/macro-dep-test/blob/master/README.md for context.
This commit is contained in:
parent
27fac08c82
commit
5211972743
19 changed files with 58 additions and 56 deletions
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "lsp-server"
|
||||
version = "0.7.7"
|
||||
version = "0.7.8"
|
||||
description = "Generic LSP server scaffold."
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/rust-lang/rust-analyzer/tree/master/lib/lsp-server"
|
||||
|
|
@ -9,7 +9,8 @@ edition = "2021"
|
|||
[dependencies]
|
||||
log = "0.4.17"
|
||||
serde_json = "1.0.108"
|
||||
serde = { version = "1.0.192", features = ["derive"] }
|
||||
serde = { version = "1.0.216" }
|
||||
serde_derive = { version = "1.0.216" }
|
||||
crossbeam-channel.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@ use std::{
|
|||
io::{self, BufRead, Write},
|
||||
};
|
||||
|
||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
use crate::error::ExtractError;
|
||||
|
||||
|
|
@ -196,7 +197,7 @@ impl Message {
|
|||
}
|
||||
|
||||
impl Response {
|
||||
pub fn new_ok<R: Serialize>(id: RequestId, result: R) -> Response {
|
||||
pub fn new_ok<R: serde::Serialize>(id: RequestId, result: R) -> Response {
|
||||
Response { id, result: Some(serde_json::to_value(result).unwrap()), error: None }
|
||||
}
|
||||
pub fn new_err(id: RequestId, code: i32, message: String) -> Response {
|
||||
|
|
@ -206,7 +207,7 @@ impl Response {
|
|||
}
|
||||
|
||||
impl Request {
|
||||
pub fn new<P: Serialize>(id: RequestId, method: String, params: P) -> Request {
|
||||
pub fn new<P: serde::Serialize>(id: RequestId, method: String, params: P) -> Request {
|
||||
Request { id, method, params: serde_json::to_value(params).unwrap() }
|
||||
}
|
||||
pub fn extract<P: DeserializeOwned>(
|
||||
|
|
@ -231,7 +232,7 @@ impl Request {
|
|||
}
|
||||
|
||||
impl Notification {
|
||||
pub fn new(method: String, params: impl Serialize) -> Notification {
|
||||
pub fn new(method: String, params: impl serde::Serialize) -> Notification {
|
||||
Notification { method, params: serde_json::to_value(params).unwrap() }
|
||||
}
|
||||
pub fn extract<P: DeserializeOwned>(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::{ErrorCode, Request, RequestId, Response, ResponseError};
|
||||
|
||||
/// Manages the set of pending requests, both incoming and outgoing.
|
||||
|
|
@ -56,7 +54,7 @@ impl<I> Incoming<I> {
|
|||
}
|
||||
|
||||
impl<O> Outgoing<O> {
|
||||
pub fn register<P: Serialize>(&mut self, method: String, params: P, data: O) -> Request {
|
||||
pub fn register<P: serde::Serialize>(&mut self, method: String, params: P, data: O) -> Request {
|
||||
let id = RequestId::from(self.next_id);
|
||||
self.pending.insert(id.clone(), data);
|
||||
self.next_id += 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue