mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
cargo format
This commit is contained in:
parent
f032eeb05f
commit
ebb40c7f87
4 changed files with 4 additions and 12 deletions
|
@ -127,8 +127,7 @@ fn initialize(
|
||||||
sender.send(RawMessage::Response(resp)).unwrap();
|
sender.send(RawMessage::Response(resp)).unwrap();
|
||||||
match receiver.recv() {
|
match receiver.recv() {
|
||||||
Ok(RawMessage::Notification(n)) => {
|
Ok(RawMessage::Notification(n)) => {
|
||||||
n.cast::<Initialized>()
|
n.cast::<Initialized>().map_err(|_| "expected initialized notification")?;
|
||||||
.map_err(|_| "expected initialized notification")?;
|
|
||||||
}
|
}
|
||||||
_ => Err(format!("expected initialized notification"))?,
|
_ => Err(format!("expected initialized notification"))?,
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,8 +182,7 @@ fn read_msg_text(inp: &mut impl BufRead) -> Result<Option<String>> {
|
||||||
}
|
}
|
||||||
let mut parts = buf.splitn(2, ": ");
|
let mut parts = buf.splitn(2, ": ");
|
||||||
let header_name = parts.next().unwrap();
|
let header_name = parts.next().unwrap();
|
||||||
let header_value =
|
let header_value = parts.next().ok_or_else(|| format!("malformed header: {:?}", buf))?;
|
||||||
parts.next().ok_or_else(|| format!("malformed header: {:?}", buf))?;
|
|
||||||
if header_name == "Content-Length" {
|
if header_name == "Content-Length" {
|
||||||
size = Some(header_value.parse::<usize>()?);
|
size = Some(header_value.parse::<usize>()?);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ mod vfs_filter;
|
||||||
|
|
||||||
use std::{sync::Arc, path::Path, collections::HashSet, error::Error};
|
use std::{sync::Arc, path::Path, collections::HashSet, error::Error};
|
||||||
|
|
||||||
|
|
||||||
use rustc_hash::FxHashMap;
|
use rustc_hash::FxHashMap;
|
||||||
|
|
||||||
use ra_db::{
|
use ra_db::{
|
||||||
|
|
|
@ -399,8 +399,7 @@ fn on_notification(
|
||||||
Ok(mut params) => {
|
Ok(mut params) => {
|
||||||
let uri = params.text_document.uri;
|
let uri = params.text_document.uri;
|
||||||
let path = uri.to_file_path().map_err(|()| format!("invalid uri: {}", uri))?;
|
let path = uri.to_file_path().map_err(|()| format!("invalid uri: {}", uri))?;
|
||||||
let text =
|
let text = params.content_changes.pop().ok_or_else(|| format!("empty changes"))?.text;
|
||||||
params.content_changes.pop().ok_or_else(|| format!("empty changes"))?.text;
|
|
||||||
state.vfs.write().change_file_overlay(path.as_path(), text);
|
state.vfs.write().change_file_overlay(path.as_path(), text);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
@ -548,11 +547,7 @@ where
|
||||||
error: None,
|
error: None,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
RawResponse::err(
|
RawResponse::err(id, ErrorCode::InternalError as i32, e.to_string())
|
||||||
id,
|
|
||||||
ErrorCode::InternalError as i32,
|
|
||||||
e.to_string()
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue