Skip to content

Commit

Permalink
BE: only call runnable_names once for ct_diagnostics
Browse files Browse the repository at this point in the history
Summary: Refactor the code to only call `common_test::runnable_names` once.

Reviewed By: robertoaloi

Differential Revision: D51465969

fbshipit-source-id: 060713c52c6f48923434512f59648f38b5c000f1
  • Loading branch information
alanz authored and facebook-github-bot committed Nov 20, 2023
1 parent 7902b47 commit 2111605
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions crates/ide/src/common_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,10 @@ pub fn unreachable_test(
res: &mut Vec<Diagnostic>,
sema: &Semantic,
file_id: FileId,
all: FxHashSet<TestDef>,
groups: FxHashMap<SmolStr, GroupDef>,
testcases: &Option<FxHashSet<NameArity>>,
) {
let exported_test_ranges = exported_test_ranges(sema, file_id);
if let Ok(runnable_names) = runnable_names(sema, file_id, all, groups) {
if let Some(runnable_names) = testcases {
for (name, range) in exported_test_ranges {
if !runnable_names.contains(&name) {
let d = Diagnostic::new(
Expand Down
6 changes: 3 additions & 3 deletions crates/ide/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1221,9 +1221,9 @@ pub fn ct_diagnostics(db: &RootDatabase, file_id: FileId) -> Vec<Diagnostic> {

match &*ct_info(db, file_id) {
CommonTestInfo::Result { all, groups } => {
common_test::unreachable_test(&mut res, &sema, file_id, all.clone(), groups.clone());
// @fb-only: let testcases =
// @fb-only: common_test::runnable_names(&sema, file_id, all.clone(), groups.clone()).ok();
let testcases =
common_test::runnable_names(&sema, file_id, all.clone(), groups.clone()).ok();
common_test::unreachable_test(&mut res, &sema, file_id, &testcases);
// @fb-only: meta_only::ct_diagnostics(&mut res, &sema, file_id, testcases);
}
_ => (),
Expand Down

0 comments on commit 2111605

Please sign in to comment.