Add cov_marks to test #17927

This commit is contained in:
Chayim Refael Friedman 2024-08-22 14:19:56 +03:00
parent d89bdd9b83
commit 6a910f637e
2 changed files with 19 additions and 0 deletions

View file

@ -629,6 +629,7 @@ impl<'a> FindUsages<'a> {
alias.syntax().text_range(),
)) {
tracing::debug!("found alias: {alias}");
cov_mark::hit!(container_use_rename);
// FIXME: `use`s have no easy way to determine their search scope, but they are rare.
to_process.push((
alias.text().to_smolstr(),
@ -644,12 +645,15 @@ impl<'a> FindUsages<'a> {
name.syntax().text_range(),
)) {
if let Some(def) = is_alias(&alias) {
cov_mark::hit!(container_type_alias);
insert_type_alias(
sema.db,
&mut to_process,
name.text().as_str(),
def.into(),
);
} else {
cov_mark::hit!(same_name_different_def_type_alias);
}
}
}
@ -706,12 +710,15 @@ impl<'a> FindUsages<'a> {
name.syntax().text_range(),
)) {
if let Some(def) = is_alias(&type_alias) {
cov_mark::hit!(self_type_alias);
insert_type_alias(
sema.db,
&mut to_process,
name.text().as_str(),
def.into(),
);
} else {
cov_mark::hit!(same_name_different_def_type_alias);
}
}
}
@ -793,6 +800,8 @@ impl<'a> FindUsages<'a> {
return false;
};
cov_mark::hit!(short_associated_function_fast_search);
// FIXME: If Rust ever gains the ability to `use Struct::method` we'll also need to account for free
// functions.
let finder = Finder::new(name.as_bytes());