From 636ca68da0a868444a77a35f25dc51978a806c29 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Sat, 27 Apr 2024 10:50:38 +0200 Subject: [PATCH] Code review feedback --- crates/red_knot/src/main.rs | 4 ++-- crates/red_knot/src/program/check.rs | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/crates/red_knot/src/main.rs b/crates/red_knot/src/main.rs index 5d1a7c79e2987..016cb5a3ea567 100644 --- a/crates/red_knot/src/main.rs +++ b/crates/red_knot/src/main.rs @@ -113,7 +113,7 @@ impl MainLoop { ( Self { - orchestrator_sender: orchestrator_sender.clone(), + orchestrator_sender, main_loop_receiver, }, MainLoopCancellationToken { @@ -293,7 +293,7 @@ impl Orchestrator { self.aggregated_changes.extend(file_changes); } - Ok(OrchestratorMessage::CheckProgramStarted {..}| OrchestratorMessage::CheckProgramCompleted(_) | OrchestratorMessage::CheckProgramCancelled) => unreachable!("The program check should be complete at this point."), + Ok(OrchestratorMessage::CheckProgramStarted {..}| OrchestratorMessage::CheckProgramCompleted(_) | OrchestratorMessage::CheckProgramCancelled) => unreachable!("No program check should be running while debouncing changes."), Ok(OrchestratorMessage::Run) => unreachable!("The orchestrator is already running."), Err(_) => { diff --git a/crates/red_knot/src/program/check.rs b/crates/red_knot/src/program/check.rs index 323d877547c0c..1d56caa5bfb2a 100644 --- a/crates/red_knot/src/program/check.rs +++ b/crates/red_knot/src/program/check.rs @@ -34,7 +34,7 @@ impl Program { } #[tracing::instrument(level = "debug", skip(self, context))] - fn check_file_with_context( + fn do_check_file( &self, file: FileId, context: &CheckContext, @@ -102,9 +102,6 @@ where } /// Scheduler that runs all checks on the current thread. -/// -/// Checks that are queued will run immediately on the current thread. -/// That means that later scheduled checks block the completion of earlier scheduled checks. pub struct SameThreadCheckScheduler<'a> { program: &'a Program, } @@ -139,7 +136,7 @@ pub struct CheckFileTask { impl CheckFileTask { /// Runs the check and communicates the result to the orchestrator. pub fn run(self, program: &Program) { - match program.check_file_with_context(self.file_id, &self.context) { + match program.do_check_file(self.file_id, &self.context) { Ok(diagnostics) => self .context .sender