From 434f108adad75b7c5e25db745a9f9fefa5cdaa31 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 24 Nov 2019 18:48:29 +0300 Subject: Simplify --- crates/ra_cli/src/analysis_stats.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_cli/src') diff --git a/crates/ra_cli/src/analysis_stats.rs b/crates/ra_cli/src/analysis_stats.rs index 9cd21e4b6..135de7ffb 100644 --- a/crates/ra_cli/src/analysis_stats.rs +++ b/crates/ra_cli/src/analysis_stats.rs @@ -109,7 +109,7 @@ pub fn run( } let body = f.body(db); let inference_result = f.infer(db); - for (expr_id, _) in body.exprs() { + for (expr_id, _) in body.exprs.iter() { let ty = &inference_result[expr_id]; num_exprs += 1; if let Ty::Unknown = ty { -- cgit v1.2.3 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/src') 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