mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 03:38:29 +00:00
lsp-server: Fix warnings about clippy str_to_string
rule
This commit is contained in:
parent
c3699b9f32
commit
bffb8880d5
@ -360,12 +360,12 @@ impl Connection {
|
|||||||
}
|
}
|
||||||
Err(RecvTimeoutError::Timeout) => {
|
Err(RecvTimeoutError::Timeout) => {
|
||||||
return Err(ProtocolError::new(
|
return Err(ProtocolError::new(
|
||||||
"timed out waiting for exit notification".to_string(),
|
"timed out waiting for exit notification".to_owned(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
Err(RecvTimeoutError::Disconnected) => {
|
Err(RecvTimeoutError::Disconnected) => {
|
||||||
return Err(ProtocolError::new(
|
return Err(ProtocolError::new(
|
||||||
"channel disconnected waiting for exit notification".to_string(),
|
"channel disconnected waiting for exit notification".to_owned(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -406,7 +406,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn not_exit_notification() {
|
fn not_exit_notification() {
|
||||||
let notification = crate::Notification {
|
let notification = crate::Notification {
|
||||||
method: Initialized::METHOD.to_string(),
|
method: Initialized::METHOD.to_owned(),
|
||||||
params: to_value(InitializedParams {}).unwrap(),
|
params: to_value(InitializedParams {}).unwrap(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -414,7 +414,7 @@ mod tests {
|
|||||||
let req_id = RequestId::from(234);
|
let req_id = RequestId::from(234);
|
||||||
let request = crate::Request {
|
let request = crate::Request {
|
||||||
id: req_id.clone(),
|
id: req_id.clone(),
|
||||||
method: Initialize::METHOD.to_string(),
|
method: Initialize::METHOD.to_owned(),
|
||||||
params: params_as_value.clone(),
|
params: params_as_value.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -427,7 +427,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn exit_notification() {
|
fn exit_notification() {
|
||||||
let notification =
|
let notification =
|
||||||
crate::Notification { method: Exit::METHOD.to_string(), params: to_value(()).unwrap() };
|
crate::Notification { method: Exit::METHOD.to_owned(), params: to_value(()).unwrap() };
|
||||||
let notification_msg = Message::from(notification);
|
let notification_msg = Message::from(notification);
|
||||||
|
|
||||||
initialize_start_test(TestCase {
|
initialize_start_test(TestCase {
|
||||||
|
@ -269,7 +269,7 @@ fn read_msg_text(inp: &mut dyn BufRead) -> io::Result<Option<String>> {
|
|||||||
size = Some(header_value.parse::<usize>().map_err(invalid_data)?);
|
size = Some(header_value.parse::<usize>().map_err(invalid_data)?);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let size: usize = size.ok_or_else(|| invalid_data("no Content-Length".to_string()))?;
|
let size: usize = size.ok_or_else(|| invalid_data("no Content-Length".to_owned()))?;
|
||||||
let mut buf = buf.into_bytes();
|
let mut buf = buf.into_bytes();
|
||||||
buf.resize(size, 0);
|
buf.resize(size, 0);
|
||||||
inp.read_exact(&mut buf)?;
|
inp.read_exact(&mut buf)?;
|
||||||
|
@ -40,7 +40,7 @@ impl<I> Incoming<I> {
|
|||||||
let _data = self.complete(id.clone())?;
|
let _data = self.complete(id.clone())?;
|
||||||
let error = ResponseError {
|
let error = ResponseError {
|
||||||
code: ErrorCode::RequestCanceled as i32,
|
code: ErrorCode::RequestCanceled as i32,
|
||||||
message: "canceled by client".to_string(),
|
message: "canceled by client".to_owned(),
|
||||||
data: None,
|
data: None,
|
||||||
};
|
};
|
||||||
Some(Response { id, result: None, error: Some(error) })
|
Some(Response { id, result: None, error: Some(error) })
|
||||||
|
Loading…
Reference in New Issue
Block a user