Skip to content

Commit

Permalink
disgnostic descriptor: missing_compile_warn_missing_spec
Browse files Browse the repository at this point in the history
Summary: As title

Reviewed By: robertoaloi

Differential Revision: D55737949

fbshipit-source-id: 2fd27f470e6e6ab9c24f75257b079b4d0cf78fcf
  • Loading branch information
alanz authored and facebook-github-bot committed Apr 5, 2024
1 parent e2403d2 commit 7720d85
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/ide/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ pub fn diagnostics_descriptors<'a>() -> Vec<&'a DiagnosticDescriptor<'a>> {
&deprecated_function::DESCRIPTOR,
&dependent_header::DESCRIPTOR,
&slow_functions::DESCRIPTOR,
&missing_compile_warn_missing_spec::DESCRIPTOR,
]
}

Expand Down Expand Up @@ -666,7 +667,6 @@ pub fn semantic_diagnostics(
effect_free_statement::effect_free_statement(res, sema, file_id);
expression_can_be_simplified::diagnostic(res, sema, file_id);
application_env::application_env(res, sema, file_id);
missing_compile_warn_missing_spec::missing_compile_warn_missing_spec(res, sema, file_id);
}
}

Expand Down
17 changes: 15 additions & 2 deletions crates/ide/src/diagnostics/missing_compile_warn_missing_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,27 @@ use regex::Regex;
use text_edit::TextRange;

use super::Diagnostic;
use super::DiagnosticConditions;
use super::DiagnosticDescriptor;
use crate::fix;

pub(crate) fn missing_compile_warn_missing_spec(
pub(crate) static DESCRIPTOR: DiagnosticDescriptor = DiagnosticDescriptor {
conditions: DiagnosticConditions {
experimental: false,
include_generated: false,
include_tests: true,
},
checker: &|diags, sema, file_id, _ext| {
missing_compile_warn_missing_spec(diags, sema, file_id);
},
};

fn missing_compile_warn_missing_spec(
diags: &mut Vec<Diagnostic>,
sema: &Semantic,
file_id: FileId,
) {
if sema.db.is_generated(file_id) || Some(false) == is_in_src_dir(sema.db.upcast(), file_id) {
if Some(false) == is_in_src_dir(sema.db.upcast(), file_id) {
return;
}
let form_list = sema.form_list(file_id);
Expand Down

0 comments on commit 7720d85

Please sign in to comment.