Use mark/hit

This commit is contained in:
Jonas Schievink 2020-12-10 15:56:04 +01:00
parent d338513e95
commit 05d4a5a150

View file

@ -26,6 +26,7 @@ use syntax::{
ast::{self, NameOwner}, ast::{self, NameOwner},
AstNode, AstPtr, AstNode, AstPtr,
}; };
use test_utils::mark;
use crate::{ use crate::{
db::HirDatabase, db::HirDatabase,
@ -88,6 +89,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> {
fn validate_func(&mut self, db: &dyn HirDatabase, func: FunctionId) { fn validate_func(&mut self, db: &dyn HirDatabase, func: FunctionId) {
let data = db.function_data(func); let data = db.function_data(func);
if data.is_extern { if data.is_extern {
mark::hit!(extern_func_incorrect_case_ignored);
return; return;
} }
@ -653,6 +655,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> {
fn validate_static(&mut self, db: &dyn HirDatabase, static_id: StaticId) { fn validate_static(&mut self, db: &dyn HirDatabase, static_id: StaticId) {
let data = db.static_data(static_id); let data = db.static_data(static_id);
if data.is_extern { if data.is_extern {
mark::hit!(extern_static_incorrect_case_ignored);
return; return;
} }
@ -716,6 +719,8 @@ fn pat_equals_to_name(pat: Option<ast::Pat>, name: &Name) -> bool {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use test_utils::mark;
use crate::diagnostics::tests::check_diagnostics; use crate::diagnostics::tests::check_diagnostics;
#[test] #[test]
@ -930,6 +935,8 @@ fn main() {
#[test] #[test]
fn ignores_extern_items() { fn ignores_extern_items() {
mark::check!(extern_func_incorrect_case_ignored);
mark::check!(extern_static_incorrect_case_ignored);
check_diagnostics( check_diagnostics(
r#" r#"
extern { extern {