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_stats.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/crates/ra_cli/src/analysis_stats.rs b/crates/ra_cli/src/analysis_stats.rs
index 135de7ffb..c4eb28245 100644
--- a/crates/ra_cli/src/analysis_stats.rs
+++ b/crates/ra_cli/src/analysis_stats.rs
@@ -3,7 +3,7 @@
3use std::{collections::HashSet, fmt::Write, path::Path, time::Instant}; 3use std::{collections::HashSet, fmt::Write, path::Path, time::Instant};
4 4
5use ra_db::SourceDatabaseExt; 5use ra_db::SourceDatabaseExt;
6use ra_hir::{AssocItem, Crate, HasBodySource, HasSource, HirDisplay, ModuleDef, Ty, TypeWalk}; 6use ra_hir::{AssocItem, Crate, HasSource, HirDisplay, ModuleDef, Ty, TypeWalk};
7use ra_syntax::AstNode; 7use ra_syntax::AstNode;
8 8
9use crate::{Result, Verbosity}; 9use crate::{Result, Verbosity};
@@ -128,15 +128,16 @@ pub fn run(
128 if let Some(mismatch) = inference_result.type_mismatch_for_expr(expr_id) { 128 if let Some(mismatch) = inference_result.type_mismatch_for_expr(expr_id) {
129 num_type_mismatches += 1; 129 num_type_mismatches += 1;
130 if verbosity.is_verbose() { 130 if verbosity.is_verbose() {
131 let src = f.expr_source(db, expr_id); 131 let src = f.body_source_map(db).expr_syntax(expr_id);
132 if let Some(src) = src { 132 if let Some(src) = src {
133 // FIXME: it might be nice to have a function (on Analysis?) that goes from Source<T> -> (LineCol, LineCol) directly 133 // FIXME: it might be nice to have a function (on Analysis?) that goes from Source<T> -> (LineCol, LineCol) directly
134 let original_file = src.file_id.original_file(db); 134 let original_file = src.file_id.original_file(db);
135 let path = db.file_relative_path(original_file); 135 let path = db.file_relative_path(original_file);
136 let line_index = host.analysis().file_line_index(original_file).unwrap(); 136 let line_index = host.analysis().file_line_index(original_file).unwrap();
137 let text_range = src 137 let text_range = src.value.either(
138 .value 138 |it| it.syntax_node_ptr().range(),
139 .either(|it| it.syntax().text_range(), |it| it.syntax().text_range()); 139 |it| it.syntax_node_ptr().range(),
140 );
140 let (start, end) = ( 141 let (start, end) = (
141 line_index.line_col(text_range.start()), 142 line_index.line_col(text_range.start()),
142 line_index.line_col(text_range.end()), 143 line_index.line_col(text_range.end()),