Skip to content

Commit

Permalink
Code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser committed Apr 27, 2024
1 parent 23e4b4c commit 636ca68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions crates/red_knot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl MainLoop {

(
Self {
orchestrator_sender: orchestrator_sender.clone(),
orchestrator_sender,
main_loop_receiver,
},
MainLoopCancellationToken {
Expand Down Expand Up @@ -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(_) => {
Expand Down
7 changes: 2 additions & 5 deletions crates/red_knot/src/program/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 636ca68

Please sign in to comment.