diff options
| author | mo8it <mo8it@proton.me> | 2024-08-09 23:24:57 +0200 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2024-08-09 23:24:57 +0200 |
| commit | 03a7abc48fb13723bdf8132aa46bc9a5ecf0225b (patch) | |
| tree | a56cc1efe2424d5c557bbd8a3fa5f6a72e0ba50a /src/tools/rust-analyzer | |
| parent | bee4926ae76aa5bba1ab892bfa5db0f75107b1da (diff) | |
| download | rust-03a7abc48fb13723bdf8132aa46bc9a5ecf0225b.tar.gz rust-03a7abc48fb13723bdf8132aa46bc9a5ecf0225b.zip | |
Use Sender directly instead of a boxed closure
Diffstat (limited to 'src/tools/rust-analyzer')
| -rw-r--r-- | src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs | 8 | ||||
| -rw-r--r-- | src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs | 5 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs index c2b943d1d6f..168f9702d1c 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs @@ -109,7 +109,7 @@ pub(crate) struct FlycheckHandle { impl FlycheckHandle { pub(crate) fn spawn( id: usize, - sender: Box<dyn Fn(FlycheckMessage) + Send>, + sender: Sender<FlycheckMessage>, config: FlycheckConfig, sysroot_root: Option<AbsPathBuf>, workspace_root: AbsPathBuf, @@ -199,7 +199,7 @@ enum StateChange { struct FlycheckActor { /// The workspace id of this flycheck instance. id: usize, - sender: Box<dyn Fn(FlycheckMessage) + Send>, + sender: Sender<FlycheckMessage>, config: FlycheckConfig, manifest_path: Option<AbsPathBuf>, /// Either the workspace root of the workspace we are flychecking, @@ -235,7 +235,7 @@ pub(crate) const SAVED_FILE_PLACEHOLDER: &str = "$saved_file"; impl FlycheckActor { fn new( id: usize, - sender: Box<dyn Fn(FlycheckMessage) + Send>, + sender: Sender<FlycheckMessage>, config: FlycheckConfig, sysroot_root: Option<AbsPathBuf>, workspace_root: AbsPathBuf, @@ -479,7 +479,7 @@ impl FlycheckActor { } fn send(&self, check_task: FlycheckMessage) { - (self.sender)(check_task); + self.sender.send(check_task).unwrap(); } } diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs index e432f5d5cff..dee34b1b393 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs @@ -758,7 +758,7 @@ impl GlobalState { self.flycheck = match invocation_strategy { crate::flycheck::InvocationStrategy::Once => vec