aboutsummaryrefslogtreecommitdiff
path: root/crates/rust-analyzer/src/main_loop/handlers.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-03-28 11:28:31 +0000
committerGitHub <[email protected]>2020-03-28 11:28:31 +0000
commitc30425dc96895117b644f29b758cee9dac36839b (patch)
treed3ccef4aa8f681cc9de29f0435ad20e87911a6ba /crates/rust-analyzer/src/main_loop/handlers.rs
parenta1fea0d34ee8f3436aefd87d4c133a7ff50ffbb0 (diff)
parent311cbbdad599d51c6f08f7dd72c299f7c0128bb2 (diff)
Merge #3753
3753: Introduce stdx crate r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/rust-analyzer/src/main_loop/handlers.rs')
-rw-r--r--crates/rust-analyzer/src/main_loop/handlers.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs
index 1033d6de9..12f8ca297 100644
--- a/crates/rust-analyzer/src/main_loop/handlers.rs
+++ b/crates/rust-analyzer/src/main_loop/handlers.rs
@@ -3,7 +3,6 @@
3//! `ra_ide` crate. 3//! `ra_ide` crate.
4 4
5use std::{ 5use std::{
6 fmt::Write as _,
7 io::Write as _, 6 io::Write as _,
8 process::{self, Stdio}, 7 process::{self, Stdio},
9}; 8};
@@ -28,6 +27,7 @@ use ra_syntax::{AstNode, SyntaxKind, TextRange, TextUnit};
28use rustc_hash::FxHashMap; 27use rustc_hash::FxHashMap;
29use serde::{Deserialize, Serialize}; 28use serde::{Deserialize, Serialize};
30use serde_json::to_value; 29use serde_json::to_value;
30use stdx::format_to;
31 31
32use crate::{ 32use crate::{
33 cargo_target_spec::CargoTargetSpec, 33 cargo_target_spec::CargoTargetSpec,
@@ -46,11 +46,11 @@ use crate::{
46pub fn handle_analyzer_status(world: WorldSnapshot, _: ()) -> Result<String> { 46pub fn handle_analyzer_status(world: WorldSnapshot, _: ()) -> Result<String> {
47 let _p = profile("handle_analyzer_status"); 47 let _p = profile("handle_analyzer_status");
48 let mut buf = world.status(); 48 let mut buf = world.status();
49 writeln!(buf, "\n\nrequests:").unwrap(); 49 format_to!(buf, "\n\nrequests:");
50 let requests = world.latest_requests.read(); 50 let requests = world.latest_requests.read();
51 for (is_last, r) in requests.iter() { 51 for (is_last, r) in requests.iter() {
52 let mark = if is_last { "*" } else { " " }; 52 let mark = if is_last { "*" } else { " " };
53 writeln!(buf, "{}{:4} {:<36}{}ms", mark, r.id, r.method, r.duration.as_millis()).unwrap(); 53 format_to!(buf, "{}{:4} {:<36}{}ms", mark, r.id, r.method, r.duration.as_millis());
54 } 54 }
55 Ok(buf) 55 Ok(buf)
56} 56}