From e48430cbae32249e50dda1b39e0c98a31f118250 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 24 Nov 2019 20:53:42 +0300 Subject: Simplify --- crates/ra_cli/src/analysis_stats.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'crates/ra_cli') 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 @@ use std::{collections::HashSet, fmt::Write, path::Path, time::Instant}; use ra_db::SourceDatabaseExt; -use ra_hir::{AssocItem, Crate, HasBodySource, HasSource, HirDisplay, ModuleDef, Ty, TypeWalk}; +use ra_hir::{AssocItem, Crate, HasSource, HirDisplay, ModuleDef, Ty, TypeWalk}; use ra_syntax::AstNode; use crate::{Result, Verbosity}; @@ -128,15 +128,16 @@ pub fn run( if let Some(mismatch) = inference_result.type_mismatch_for_expr(expr_id) { num_type_mismatches += 1; if verbosity.is_verbose() { - let src = f.expr_source(db, expr_id); + let src = f.body_source_map(db).expr_syntax(expr_id); if let Some(src) = src { // FIXME: it might be nice to have a function (on Analysis?) that goes from Source -> (LineCol, LineCol) directly let original_file = src.file_id.original_file(db); let path = db.file_relative_path(original_file); let line_index = host.analysis().file_line_index(original_file).unwrap(); - let text_range = src - .value - .either(|it| it.syntax().text_range(), |it| it.syntax().text_range()); + let text_range = src.value.either( + |it| it.syntax_node_ptr().range(), + |it| it.syntax_node_ptr().range(), + ); let (start, end) = ( line_index.line_col(text_range.start()), line_index.line_col(text_range.end()), -- cgit v1.2.3