diff --git a/caracal-daemon/src/cli/mod.rs b/caracal-daemon/src/cli/mod.rs index 4cbdb0e..8e69ec9 100644 --- a/caracal-daemon/src/cli/mod.rs +++ b/caracal-daemon/src/cli/mod.rs @@ -115,9 +115,12 @@ mod tests { #[test] fn test_command_simple() { - match Cli::parse_from(["program_name", "version"]).commands { - Some(Commands::Version { .. }) => (), - _ => panic!(), + if let Some(Commands::Version { .. }) = + Cli::parse_from(["program_name", "version"]).commands + { + // everything is good. + } else { + panic!(); } } } diff --git a/caracal/src/cli/mod.rs b/caracal/src/cli/mod.rs index 279f42a..a906bc4 100644 --- a/caracal/src/cli/mod.rs +++ b/caracal/src/cli/mod.rs @@ -368,9 +368,12 @@ mod tests { #[test] fn test_command_simple() { - match Cli::parse_from(["program_name", "version"]).commands { - Some(Commands::Version { .. }) => (), - _ => panic!(), + if let Some(Commands::Version { .. }) = + Cli::parse_from(["program_name", "version"]).commands + { + // everything is good. + } else { + panic!(); } } } diff --git a/crates/engine/src/downloader/mod.rs b/crates/engine/src/downloader/mod.rs index 69af1cf..2267549 100644 --- a/crates/engine/src/downloader/mod.rs +++ b/crates/engine/src/downloader/mod.rs @@ -251,7 +251,7 @@ impl Downloader { file_path: file_path.clone(), chunk_receiver: chunk_receiver.clone(), progress_updater: ProgressUpdater::from(event_sender.clone()), - worker_event_receiver, + event_receiver: worker_event_receiver, }; let _handle = join_set.spawn(worker.serve()); } @@ -311,7 +311,7 @@ impl Downloader { sink: sink.clone(), source: source.clone(), file_path: file_path.clone(), - worker_event_receiver, + event_receiver: worker_event_receiver, }; join_set.spawn(worker.serve()) diff --git a/crates/engine/src/downloader/worker.rs b/crates/engine/src/downloader/worker.rs index 926266c..7c47934 100644 --- a/crates/engine/src/downloader/worker.rs +++ b/crates/engine/src/downloader/worker.rs @@ -21,8 +21,8 @@ pub struct Worker { pub source: Fetcher, pub file_path: PathBuf, pub chunk_receiver: async_channel::Receiver, + pub event_receiver: mpsc::UnboundedReceiver, pub progress_updater: ProgressUpdater, - pub worker_event_receiver: mpsc::UnboundedReceiver, } impl Worker { @@ -33,8 +33,8 @@ impl Worker { sink, file_path, chunk_receiver, + mut event_receiver, progress_updater, - mut worker_event_receiver, } = self; while let Ok(chunk) = chunk_receiver.recv().await { @@ -55,7 +55,7 @@ impl Worker { loop { let new_bytes = stream.bytes(); - let new_event = worker_event_receiver.recv(); + let new_event = event_receiver.recv(); futures::pin_mut!(new_bytes); futures::pin_mut!(new_event); diff --git a/flake.lock b/flake.lock index fcb4cab..d427964 100644 --- a/flake.lock +++ b/flake.lock @@ -28,11 +28,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1703571730, - "narHash": "sha256-laQaEJYQsclD4wwjmKYjF7GJZuc3aiAuztPIscDcR2k=", + "lastModified": 1704003651, + "narHash": "sha256-bA3d4E1CX5G7TVbKwJOm9jZfVOGOPp6u5CKEUzNsE8E=", "owner": "nix-community", "repo": "fenix", - "rev": "a3b2682c6baed4adb791efbd9021f90cbef5eace", + "rev": "c6d82e087ac96f24b90c5787a17e29a72566c2b4", "type": "github" }, "original": { @@ -61,11 +61,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1703255338, - "narHash": "sha256-Z6wfYJQKmDN9xciTwU3cOiOk+NElxdZwy/FiHctCzjU=", + "lastModified": 1703637592, + "narHash": "sha256-8MXjxU0RfFfzl57Zy3OfXCITS0qWDNLzlBAdwxGZwfY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6df37dc6a77654682fe9f071c62b4242b5342e04", + "rev": "cfc3698c31b1fb9cdcf10f36c9643460264d0ca8", "type": "github" }, "original": { @@ -86,11 +86,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1703421399, - "narHash": "sha256-GRRhRsZvVgH/Rx2zic0c1Rxt7VumRPqsan6sqculRvU=", + "lastModified": 1703965384, + "narHash": "sha256-3iyouqkBvhh/E48TkBlt4JmmcIEyfQwY7pokKBx9WNg=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "85fb463fc586594925f05fc8e285b1568f98f41a", + "rev": "e872f5085cf5b0e44558442365c1c033d486eff2", "type": "github" }, "original": {