cargo format

This commit is contained in:
Muhammad Mominul Huque 2019-06-15 13:37:15 +06:00
parent f032eeb05f
commit ebb40c7f87
No known key found for this signature in database
GPG key ID: 37AF141540DE557D
4 changed files with 4 additions and 12 deletions

View file

@ -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"))?,
} }

View file

@ -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>()?);
} }

View file

@ -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::{

View file

@ -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()
)
} }
} }
}, },