Don't consume instances that are Send+Sync+Clone

They don't actually need it.
This commit is contained in:
Sebastian Thiel 2024-04-09 22:36:04 +02:00
parent de6fd55658
commit 52c637504e
No known key found for this signature in database
GPG Key ID: 9CB5EE7895E8268B
2 changed files with 4 additions and 3 deletions

View File

@ -40,7 +40,7 @@ impl Dispatcher {
} }
pub fn run<P: AsRef<path::Path>>( pub fn run<P: AsRef<path::Path>>(
self, &self,
project_id: &ProjectId, project_id: &ProjectId,
path: P, path: P,
) -> Result<Receiver<events::Event>, RunError> { ) -> Result<Receiver<events::Event>, RunError> {
@ -54,10 +54,11 @@ impl Dispatcher {
let (tx, rx) = channel(1); let (tx, rx) = channel(1);
let project_id = *project_id; let project_id = *project_id;
let cancellation_token = self.cancellation_token.clone();
task::spawn(async move { task::spawn(async move {
loop { loop {
select! { select! {
() = self.cancellation_token.cancelled() => { () = cancellation_token.cancelled() => {
break; break;
} }
Some(event) = file_change_rx.recv() => { Some(event) = file_change_rx.recv() => {

View File

@ -45,7 +45,7 @@ impl Dispatcher {
} }
pub fn run( pub fn run(
self, &self,
project_id: &ProjectId, project_id: &ProjectId,
path: &path::Path, path: &path::Path,
) -> Result<Receiver<events::Event>, RunError> { ) -> Result<Receiver<events::Event>, RunError> {