diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-11-24 17:54:14 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-11-24 17:54:14 +0000 |
commit | 64fc9ac9650afb04a353ba8a18381f0db83cbc82 (patch) | |
tree | 18e4c33b4ca4dfbf8ea8a797bfb7b856865b21c8 /crates/ra_cli/src | |
parent | a58db5712f4fc82845e9397f728815d389c3c38b (diff) | |
parent | e48430cbae32249e50dda1b39e0c98a31f118250 (diff) |
Merge #2390
2390: Simplify r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_cli/src')
-rw-r--r-- | crates/ra_cli/src/analysis_stats.rs | 11 |
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 @@ | |||
3 | use std::{collections::HashSet, fmt::Write, path::Path, time::Instant}; | 3 | use std::{collections::HashSet, fmt::Write, path::Path, time::Instant}; |
4 | 4 | ||
5 | use ra_db::SourceDatabaseExt; | 5 | use ra_db::SourceDatabaseExt; |
6 | use ra_hir::{AssocItem, Crate, HasBodySource, HasSource, HirDisplay, ModuleDef, Ty, TypeWalk}; | 6 | use ra_hir::{AssocItem, Crate, HasSource, HirDisplay, ModuleDef, Ty, TypeWalk}; |
7 | use ra_syntax::AstNode; | 7 | use ra_syntax::AstNode; |
8 | 8 | ||
9 | use crate::{Result, Verbosity}; | 9 | use 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()), |