mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Avoid clones
This commit is contained in:
parent
80be61ed78
commit
1329dd4e28
4 changed files with 14 additions and 14 deletions
|
@ -88,7 +88,7 @@ impl RawMessage {
|
|||
}
|
||||
|
||||
impl RawRequest {
|
||||
pub fn new<R>(id: u64, params: R::Params) -> RawRequest
|
||||
pub fn new<R>(id: u64, params: &R::Params) -> RawRequest
|
||||
where
|
||||
R: Request,
|
||||
R::Params: Serialize,
|
||||
|
@ -96,7 +96,7 @@ impl RawRequest {
|
|||
RawRequest {
|
||||
id: id,
|
||||
method: R::METHOD.to_string(),
|
||||
params: to_value(¶ms).unwrap(),
|
||||
params: to_value(params).unwrap(),
|
||||
}
|
||||
}
|
||||
pub fn cast<R>(self) -> ::std::result::Result<(u64, R::Params), RawRequest>
|
||||
|
@ -114,7 +114,7 @@ impl RawRequest {
|
|||
}
|
||||
|
||||
impl RawResponse {
|
||||
pub fn ok<R>(id: u64, result: R::Result) -> RawResponse
|
||||
pub fn ok<R>(id: u64, result: &R::Result) -> RawResponse
|
||||
where R: Request,
|
||||
R::Result: Serialize,
|
||||
{
|
||||
|
@ -135,14 +135,14 @@ impl RawResponse {
|
|||
}
|
||||
|
||||
impl RawNotification {
|
||||
pub fn new<N>(params: N::Params) -> RawNotification
|
||||
pub fn new<N>(params: &N::Params) -> RawNotification
|
||||
where
|
||||
N: Notification,
|
||||
N::Params: Serialize,
|
||||
{
|
||||
RawNotification {
|
||||
method: N::METHOD.to_string(),
|
||||
params: to_value(¶ms).unwrap(),
|
||||
params: to_value(params).unwrap(),
|
||||
}
|
||||
}
|
||||
pub fn cast<N>(self) -> ::std::result::Result<N::Params, RawNotification>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue