mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
check if counts should be a thing
This commit is contained in:
parent
5282617127
commit
2e60908fde
1 changed files with 12 additions and 9 deletions
|
@ -12,6 +12,7 @@ use ide_db::{
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use profile::{memory_usage, Bytes};
|
use profile::{memory_usage, Bytes};
|
||||||
use rustc_hash::FxHashMap;
|
use rustc_hash::FxHashMap;
|
||||||
|
use std::env;
|
||||||
use stdx::format_to;
|
use stdx::format_to;
|
||||||
use syntax::{ast, Parse, SyntaxNode};
|
use syntax::{ast, Parse, SyntaxNode};
|
||||||
|
|
||||||
|
@ -40,15 +41,17 @@ pub(crate) fn status(db: &RootDatabase, file_id: Option<FileId>) -> String {
|
||||||
format_to!(buf, "{}\n", syntax_tree_stats(db));
|
format_to!(buf, "{}\n", syntax_tree_stats(db));
|
||||||
format_to!(buf, "{} (Macros)\n", macro_syntax_tree_stats(db));
|
format_to!(buf, "{} (Macros)\n", macro_syntax_tree_stats(db));
|
||||||
format_to!(buf, "{} in total\n", memory_usage());
|
format_to!(buf, "{} in total\n", memory_usage());
|
||||||
format_to!(
|
if env::var("RA_COUNT").is_ok() {
|
||||||
buf,
|
format_to!(
|
||||||
"\nCounts:\n{}",
|
buf,
|
||||||
if count.to_string().contains("all counts are zero") {
|
"\nCounts:\n{}",
|
||||||
String::from("All counts are zero\n")
|
if count.to_string().contains("all counts are zero") {
|
||||||
} else {
|
String::from("All counts are zero\n")
|
||||||
count.to_string()
|
} else {
|
||||||
}
|
count.to_string()
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(file_id) = file_id {
|
if let Some(file_id) = file_id {
|
||||||
format_to!(buf, "\nFile info:\n");
|
format_to!(buf, "\nFile info:\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue