From 54e53cc9ea0767dfe8a44f92361f68c03f5f038f Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Fri, 12 Feb 2021 21:08:36 +1100 Subject: chore: Update to Rust 1.50.0 (#9479) --- cli/bench/main.rs | 4 ++-- cli/bench/throughput.rs | 4 ++-- cli/lsp/language_server.rs | 6 +++--- cli/lsp/tsc.rs | 1 + 4 files changed, 8 insertions(+), 7 deletions(-) (limited to 'cli') diff --git a/cli/bench/main.rs b/cli/bench/main.rs index 352c93010..d2823a02b 100644 --- a/cli/bench/main.rs +++ b/cli/bench/main.rs @@ -297,9 +297,9 @@ fn run_throughput(deno_exe: &PathBuf) -> Result> { let mut m = HashMap::::new(); m.insert("100M_tcp".to_string(), throughput::tcp(deno_exe, 100)?); - m.insert("100M_cat".to_string(), throughput::cat(deno_exe, 100)?); + m.insert("100M_cat".to_string(), throughput::cat(deno_exe, 100)); m.insert("10M_tcp".to_string(), throughput::tcp(deno_exe, 10)?); - m.insert("10M_cat".to_string(), throughput::cat(deno_exe, 10)?); + m.insert("10M_cat".to_string(), throughput::cat(deno_exe, 10)); Ok(m) } diff --git a/cli/bench/throughput.rs b/cli/bench/throughput.rs index 6fd3972d1..83032e7a1 100644 --- a/cli/bench/throughput.rs +++ b/cli/bench/throughput.rs @@ -11,7 +11,7 @@ const MB: usize = 1024 * 1024; const SERVER_ADDR: &str = "0.0.0.0:4544"; const CLIENT_ADDR: &str = "127.0.0.1 4544"; -pub(crate) fn cat(deno_exe: &PathBuf, megs: usize) -> Result { +pub(crate) fn cat(deno_exe: &PathBuf, megs: usize) -> f64 { let size = megs * MB; let shell_cmd = format!( "{} run --allow-read cli/tests/cat.ts /dev/zero | head -c {}", @@ -25,7 +25,7 @@ pub(crate) fn cat(deno_exe: &PathBuf, megs: usize) -> Result { let _ = test_util::run_collect(cmd, None, None, None, true); let end = Instant::now(); - Ok((end - start).as_secs_f64()) + (end - start).as_secs_f64() } pub(crate) fn tcp(deno_exe: &PathBuf, megs: usize) -> Result { diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 7ae4de978..5b4ab0f99 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -1685,7 +1685,7 @@ impl Inner { Some(Err(err)) => Err(LspError::invalid_params(err.to_string())), None => Err(LspError::invalid_params("Missing parameters")), }, - "deno/performance" => self.get_performance(), + "deno/performance" => Ok(Some(self.get_performance())), "deno/virtualTextDocument" => match params.map(serde_json::from_value) { Some(Ok(params)) => Ok(Some( serde_json::to_value(self.virtual_text_document(params).await?) @@ -1902,9 +1902,9 @@ impl Inner { Ok(true) } - fn get_performance(&self) -> LspResult> { + fn get_performance(&self) -> Value { let averages = self.performance.averages(); - Ok(Some(json!({ "averages": averages }))) + json!({ "averages": averages }) } async fn virtual_text_document( diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs index a66541dd2..9a5b94f85 100644 --- a/cli/lsp/tsc.rs +++ b/cli/lsp/tsc.rs @@ -1175,6 +1175,7 @@ fn respond(state: &mut State, args: Value) -> Result { Ok(json!(true)) } +#[allow(clippy::unnecessary_wraps)] fn script_names(state: &mut State, _args: Value) -> Result { Ok(json!(state.state_snapshot.documents.open_specifiers())) } -- cgit v1.2.3