From 13cc3acdfdcff91c059f4153c694464750a67b82 Mon Sep 17 00:00:00 2001 From: mo8it Date: Tue, 20 Aug 2024 13:56:52 +0200 Subject: [PATCH] Improve readability --- src/cmd.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cmd.rs b/src/cmd.rs index a10a7eaa..4a93312a 100644 --- a/src/cmd.rs +++ b/src/cmd.rs @@ -74,12 +74,14 @@ impl CmdRunner { bail!("The command `cargo metadata …` failed. Are you in the `rustlings/` directory?"); } - let target_dir = serde_json::de::from_slice::(&metadata_output.stdout) + let metadata: CargoMetadata = serde_json::de::from_slice(&metadata_output.stdout) .context( "Failed to read the field `target_directory` from the output of the command `cargo metadata …`", - )?.target_directory; + )?; - Ok(Self { target_dir }) + Ok(Self { + target_dir: metadata.target_directory, + }) } pub fn cargo<'out>(