1245: Add profiling to diagnostics r=matklad a=marcogroppo

Add profiling to `diagnostics()` - see #1244.

Co-authored-by: Marco Groppo <marco.groppo@gmail.com>
This commit is contained in:
bors[bot] 2019-05-05 16:02:19 +00:00
commit 3ea25a66a8

View File

@ -8,6 +8,7 @@ use ra_syntax::{
ast::{self, AstNode}, ast::{self, AstNode},
}; };
use ra_text_edit::{TextEdit, TextEditBuilder}; use ra_text_edit::{TextEdit, TextEditBuilder};
use ra_prof::profile;
use crate::{Diagnostic, FileId, FileSystemEdit, SourceChange, SourceFileEdit, db::RootDatabase}; use crate::{Diagnostic, FileId, FileSystemEdit, SourceChange, SourceFileEdit, db::RootDatabase};
@ -18,6 +19,7 @@ pub enum Severity {
} }
pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec<Diagnostic> { pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec<Diagnostic> {
let _p = profile("diagnostics");
let source_file = db.parse(file_id); let source_file = db.parse(file_id);
let mut res = Vec::new(); let mut res = Vec::new();