Skip to content

Commit

Permalink
lsp-server: Fix warnings about clippy str_to_string rule
Browse files Browse the repository at this point in the history
  • Loading branch information
tetsuharuohzeki committed Feb 9, 2024
1 parent c3699b9 commit bffb888
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lib/lsp-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,12 @@ impl Connection {
}
Err(RecvTimeoutError::Timeout) => {
return Err(ProtocolError::new(
"timed out waiting for exit notification".to_string(),
"timed out waiting for exit notification".to_owned(),
))
}
Err(RecvTimeoutError::Disconnected) => {
return Err(ProtocolError::new(
"channel disconnected waiting for exit notification".to_string(),
"channel disconnected waiting for exit notification".to_owned(),
))
}
}
Expand Down Expand Up @@ -406,15 +406,15 @@ mod tests {
#[test]
fn not_exit_notification() {
let notification = crate::Notification {
method: Initialized::METHOD.to_string(),
method: Initialized::METHOD.to_owned(),
params: to_value(InitializedParams {}).unwrap(),
};

let params_as_value = to_value(InitializeParams::default()).unwrap();
let req_id = RequestId::from(234);
let request = crate::Request {
id: req_id.clone(),
method: Initialize::METHOD.to_string(),
method: Initialize::METHOD.to_owned(),
params: params_as_value.clone(),
};

Expand All @@ -427,7 +427,7 @@ mod tests {
#[test]
fn exit_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);

initialize_start_test(TestCase {
Expand Down
2 changes: 1 addition & 1 deletion lib/lsp-server/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?);
}
}
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();
buf.resize(size, 0);
inp.read_exact(&mut buf)?;
Expand Down
2 changes: 1 addition & 1 deletion lib/lsp-server/src/req_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl<I> Incoming<I> {
let _data = self.complete(id.clone())?;
let error = ResponseError {
code: ErrorCode::RequestCanceled as i32,
message: "canceled by client".to_string(),
message: "canceled by client".to_owned(),
data: None,
};
Some(Response { id, result: None, error: Some(error) })
Expand Down

0 comments on commit bffb888

Please sign in to comment.