aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_cli
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_cli')
-rw-r--r--crates/ra_cli/src/analysis_bench.rs5
-rw-r--r--crates/ra_cli/src/analysis_stats.rs9
2 files changed, 9 insertions, 5 deletions
diff --git a/crates/ra_cli/src/analysis_bench.rs b/crates/ra_cli/src/analysis_bench.rs
index 9e76bcebf..01b96ec58 100644
--- a/crates/ra_cli/src/analysis_bench.rs
+++ b/crates/ra_cli/src/analysis_bench.rs
@@ -34,10 +34,11 @@ pub(crate) fn run(verbose: bool, path: &Path, op: Op) -> Result<()> {
34 .iter() 34 .iter()
35 .find_map(|(source_root_id, project_root)| { 35 .find_map(|(source_root_id, project_root)| {
36 if project_root.is_member() { 36 if project_root.is_member() {
37 for (rel_path, file_id) in &db.source_root(*source_root_id).files { 37 for file_id in db.source_root(*source_root_id).walk() {
38 let rel_path = db.file_relative_path(file_id);
38 let abs_path = rel_path.to_path(project_root.path()); 39 let abs_path = rel_path.to_path(project_root.path());
39 if abs_path == path { 40 if abs_path == path {
40 return Some(*file_id); 41 return Some(file_id);
41 } 42 }
42 } 43 }
43 } 44 }
diff --git a/crates/ra_cli/src/analysis_stats.rs b/crates/ra_cli/src/analysis_stats.rs
index d355fa2e8..1fad5b233 100644
--- a/crates/ra_cli/src/analysis_stats.rs
+++ b/crates/ra_cli/src/analysis_stats.rs
@@ -1,7 +1,7 @@
1use std::{collections::HashSet, fmt::Write, path::Path, time::Instant}; 1use std::{collections::HashSet, fmt::Write, path::Path, time::Instant};
2 2
3use ra_db::SourceDatabase; 3use ra_db::SourceDatabase;
4use ra_hir::{Crate, HasBodySource, HasSource, HirDisplay, ImplItem, ModuleDef, Ty}; 4use ra_hir::{Crate, HasBodySource, HasSource, HirDisplay, ImplItem, ModuleDef, Ty, TypeWalk};
5use ra_syntax::AstNode; 5use ra_syntax::AstNode;
6 6
7use crate::Result; 7use crate::Result;
@@ -110,9 +110,12 @@ pub fn run(verbose: bool, memory_usage: bool, path: &Path, only: Option<&str>) -
110 let original_file = src.file_id.original_file(db); 110 let original_file = src.file_id.original_file(db);
111 let path = db.file_relative_path(original_file); 111 let path = db.file_relative_path(original_file);
112 let line_index = host.analysis().file_line_index(original_file).unwrap(); 112 let line_index = host.analysis().file_line_index(original_file).unwrap();
113 let text_range = src
114 .ast
115 .either(|it| it.syntax().text_range(), |it| it.syntax().text_range());
113 let (start, end) = ( 116 let (start, end) = (
114 line_index.line_col(src.ast.syntax().text_range().start()), 117 line_index.line_col(text_range.start()),
115 line_index.line_col(src.ast.syntax().text_range().end()), 118 line_index.line_col(text_range.end()),
116 ); 119 );
117 bar.println(format!( 120 bar.println(format!(
118 "{} {}:{}-{}:{}: Expected {}, got {}", 121 "{} {}:{}-{}:{}: Expected {}, got {}",