Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-diagnostics/src/lib.rs')
-rw-r--r--crates/ide-diagnostics/src/lib.rs35
1 files changed, 8 insertions, 27 deletions
diff --git a/crates/ide-diagnostics/src/lib.rs b/crates/ide-diagnostics/src/lib.rs
index 7743b060c8..5ad7069e31 100644
--- a/crates/ide-diagnostics/src/lib.rs
+++ b/crates/ide-diagnostics/src/lib.rs
@@ -44,30 +44,30 @@ mod handlers {
pub(crate) mod private_assoc_item;
pub(crate) mod private_field;
pub(crate) mod replace_filter_map_next_with_find_map;
- pub(crate) mod trait_impl_orphan;
pub(crate) mod trait_impl_incorrect_safety;
pub(crate) mod trait_impl_missing_assoc_item;
+ pub(crate) mod trait_impl_orphan;
pub(crate) mod trait_impl_redundant_assoc_item;
- pub(crate) mod typed_hole;
pub(crate) mod type_mismatch;
+ pub(crate) mod typed_hole;
+ pub(crate) mod undeclared_label;
pub(crate) mod unimplemented_builtin_macro;
+ pub(crate) mod unreachable_label;
pub(crate) mod unresolved_assoc_item;
pub(crate) mod unresolved_extern_crate;
pub(crate) mod unresolved_field;
- pub(crate) mod unresolved_method;
pub(crate) mod unresolved_import;
pub(crate) mod unresolved_macro_call;
+ pub(crate) mod unresolved_method;
pub(crate) mod unresolved_module;
pub(crate) mod unresolved_proc_macro;
- pub(crate) mod undeclared_label;
- pub(crate) mod unreachable_label;
pub(crate) mod unused_variables;
// The handlers below are unusual, the implement the diagnostics as well.
pub(crate) mod field_shorthand;
- pub(crate) mod useless_braces;
- pub(crate) mod unlinked_file;
pub(crate) mod json_is_not_rust;
+ pub(crate) mod unlinked_file;
+ pub(crate) mod useless_braces;
}
#[cfg(test)]
@@ -89,7 +89,6 @@ use ide_db::{
use once_cell::sync::Lazy;
use stdx::never;
use syntax::{
- algo::find_node_at_range,
ast::{self, AstNode},
AstPtr, SyntaxNode, SyntaxNodePtr, TextRange,
};
@@ -293,7 +292,7 @@ pub fn diagnostics(
resolve: &AssistResolveStrategy,
file_id: FileId,
) -> Vec<Diagnostic> {
- let _p = profile::span("diagnostics");
+ let _p = tracing::span!(tracing::Level::INFO, "diagnostics").entered();
let sema = Semantics::new(db);
let parse = db.parse(file_id);
let mut res = Vec::new();
@@ -572,24 +571,6 @@ fn unresolved_fix(id: &'static str, label: &str, target: TextRange) -> Assist {
fn adjusted_display_range<N: AstNode>(
ctx: &DiagnosticsContext<'_>,
- diag_ptr: InFile<SyntaxNodePtr>,
- adj: &dyn Fn(N) -> Option<TextRange>,
-) -> FileRange {
- let FileRange { file_id, range } = ctx.sema.diagnostics_display_range(diag_ptr);
-
- let source_file = ctx.sema.db.parse(file_id);
- FileRange {
- file_id,
- range: find_node_at_range::<N>(&source_file.syntax_node(), range)
- .filter(|it| it.syntax().text_range() == range)
- .and_then(adj)
- .unwrap_or(range),
- }
-}
-
-// FIXME Replace the one above with this one?
-fn adjusted_display_range_new<N: AstNode>(
- ctx: &DiagnosticsContext<'_>,
diag_ptr: InFile<AstPtr<N>>,
adj: &dyn Fn(N) -> Option<TextRange>,
) -> FileRange {