Remove some more unwraps

pull/2890/head
Blaž Hrastnik 2 years ago
parent 33d287a9ad
commit 24f03097e3

@ -271,8 +271,8 @@ impl Client {
// ------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------
pub(crate) async fn initialize(&self) -> Result<lsp::InitializeResult> { pub(crate) async fn initialize(&self) -> Result<lsp::InitializeResult> {
if self.config.is_some() { if let Some(config) = &self.config {
log::info!("Using custom LSP config: {}", self.config.as_ref().unwrap()); log::info!("Using custom LSP config: {}", config);
} }
#[allow(deprecated)] #[allow(deprecated)]
@ -896,8 +896,8 @@ impl Client {
Some(lsp::OneOf::Left(true)) | Some(lsp::OneOf::Right(_)) => (), Some(lsp::OneOf::Left(true)) | Some(lsp::OneOf::Right(_)) => (),
// None | Some(false) // None | Some(false)
_ => { _ => {
log::warn!("rename_symbol failed: The server does not support rename");
let err = "The server does not support rename"; let err = "The server does not support rename";
log::warn!("rename_symbol failed: {}", err);
return Err(anyhow!(err)); return Err(anyhow!(err));
} }
}; };

@ -310,7 +310,7 @@ fn method_call_serialize() {
id: Id::Num(1), id: Id::Num(1),
}; };
let serialized = serde_json::to_string(&m).unwrap(); let serialized = serde_json::json!(&m);
assert_eq!( assert_eq!(
serialized, serialized,
r#"{"jsonrpc":"2.0","method":"update","params":[1,2],"id":1}"# r#"{"jsonrpc":"2.0","method":"update","params":[1,2],"id":1}"#
@ -327,7 +327,7 @@ fn notification_serialize() {
params: Params::Array(vec![Value::from(1), Value::from(2)]), params: Params::Array(vec![Value::from(1), Value::from(2)]),
}; };
let serialized = serde_json::to_string(&n).unwrap(); let serialized = serde_json::json!(&n);
assert_eq!( assert_eq!(
serialized, serialized,
r#"{"jsonrpc":"2.0","method":"update","params":[1,2]}"# r#"{"jsonrpc":"2.0","method":"update","params":[1,2]}"#

Loading…
Cancel
Save