From 7b3a89e0551adc8d8028278f0e09d746ff04a379 Mon Sep 17 00:00:00 2001 From: Pauline Date: Sat, 11 May 2024 04:43:51 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20chore(core):=20remove=20unneeded?= =?UTF-8?q?=20`Uuid`=20borrows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/api/processor.rs | 8 ++++---- core/src/game/arguments.rs | 6 +++--- core/src/store/processor.rs | 14 +++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/core/src/api/processor.rs b/core/src/api/processor.rs index a2f86116..c8b4069a 100644 --- a/core/src/api/processor.rs +++ b/core/src/api/processor.rs @@ -6,13 +6,13 @@ use uuid::Uuid; /// check whether or not a process has completed by its [`Uuid`]. #[tracing::instrument] -pub async fn uuid_is_finished(uuid: &Uuid) -> crate::Result { +pub async fn uuid_is_finished(uuid: Uuid) -> crate::Result { Ok(uuid_exit_status(uuid).await?.is_some()) } /// check the exit status of a process by its [`Uuid`]. #[tracing::instrument] -pub async fn uuid_exit_status(uuid: &Uuid) -> crate::Result> { +pub async fn uuid_exit_status(uuid: Uuid) -> crate::Result> { let state = State::get().await?; let processor = state.processor.read().await; processor.exit_status(uuid).await @@ -60,7 +60,7 @@ pub async fn get_uuids_by_cluster_path(cluster_path: ClusterPath) -> crate::Resu /// kill an existing and running process by its [`Uuid`] #[tracing::instrument] -pub async fn kill_by_uuid(uuid: &Uuid) -> crate::Result<()> { +pub async fn kill_by_uuid(uuid: Uuid) -> crate::Result<()> { let state = State::get().await?; let processor = state.processor.read().await; @@ -74,7 +74,7 @@ pub async fn kill_by_uuid(uuid: &Uuid) -> crate::Result<()> { /// wait for a child process to finish running its manager by its [`Uuid`]. #[tracing::instrument] -pub async fn wait_for_by_uuid(uuid: &Uuid) -> crate::Result<()> { +pub async fn wait_for_by_uuid(uuid: Uuid) -> crate::Result<()> { let state = State::get().await?; let processor = state.processor.read().await; diff --git a/core/src/game/arguments.rs b/core/src/game/arguments.rs index f33c800a..2fed9085 100644 --- a/core/src/game/arguments.rs +++ b/core/src/game/arguments.rs @@ -92,7 +92,7 @@ pub fn minecraft_arguments( arg, &creds.access_token, &creds.username, - &creds.id, + creds.id, version, asset_index, game_directory, @@ -112,7 +112,7 @@ pub fn minecraft_arguments( &arg.replace(' ', DUMMY_REPLACE_NEWLINE), &creds.access_token, &creds.username, - &creds.id, + creds.id, version, asset_index, game_directory, @@ -192,7 +192,7 @@ fn parse_minecraft_argument( argument: &str, access_token: &str, username: &str, - uuid: &uuid::Uuid, + uuid: uuid::Uuid, version: &str, asset_index: &str, game_directory: &Path, diff --git a/core/src/store/processor.rs b/core/src/store/processor.rs index ae6fc19d..4c604723 100644 --- a/core/src/store/processor.rs +++ b/core/src/store/processor.rs @@ -264,8 +264,8 @@ impl Processor { } /// Returns a reference to the value corresponding to the key. - pub fn get(&self, uuid: &Uuid) -> Option>> { - self.0.get(uuid).cloned() + pub fn get(&self, uuid: Uuid) -> Option>> { + self.0.get(&uuid).cloned() } /// An collection visiting all keys in arbitrary order. @@ -277,7 +277,7 @@ impl Processor { pub async fn running(&self) -> crate::Result> { let mut keys = Vec::new(); for key in self.keys() { - if let Some(process) = self.get(&key) { + if let Some(process) = self.get(key) { let process = process.clone(); let process = process.write().await; if process @@ -300,7 +300,7 @@ impl Processor { let running = self.running().await?; let mut keys = Vec::new(); for key in running { - if let Some(process) = self.get(&key) { + if let Some(process) = self.get(key) { let process = process.clone(); let process = process.read().await; if process.cluster_path == cluster_path { @@ -315,7 +315,7 @@ impl Processor { pub async fn running_cluster_paths(&self) -> crate::Result> { let mut clusters = Vec::new(); for key in self.keys() { - if let Some(process) = self.get(&key) { + if let Some(process) = self.get(key) { let process = process.clone(); let process = process.write().await; if process @@ -337,7 +337,7 @@ impl Processor { pub async fn running_clusters(&self) -> crate::Result> { let mut clusters = Vec::new(); for key in self.keys() { - if let Some(process) = self.get(&key) { + if let Some(process) = self.get(key) { let process = process.clone(); let process = process.write().await; if process @@ -359,7 +359,7 @@ impl Processor { } /// get the exit status of a process by its [`Uuid`]. - pub async fn exit_status(&self, uuid: &Uuid) -> crate::Result> { + pub async fn exit_status(&self, uuid: Uuid) -> crate::Result> { if let Some(process) = self.get(uuid) { let process = process.write().await; let status = process.current_child.write().await.try_wait().await?;