From ff5d370569bab49cfe324fb8f42f2b2ae468e290 Mon Sep 17 00:00:00 2001 From: SyedAhkam Date: Tue, 10 Oct 2023 04:00:07 +0530 Subject: [PATCH] fix: unused import warning --- src/commands/run.rs | 72 ++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/commands/run.rs b/src/commands/run.rs index 3e55cd9..bf419f1 100644 --- a/src/commands/run.rs +++ b/src/commands/run.rs @@ -1,36 +1,36 @@ -use anyhow::{anyhow, bail, Context, Result}; -use clap::{ArgAction, Parser}; - -#[derive(Parser, Debug)] -pub struct Run { - /// Should build in release mode - #[clap(short, long, default_value="false", action = ArgAction::SetTrue)] - release: bool, -} - -pub fn handle(args: Run) -> Result<()> { - // Trigger a build - let build_status = android_cli::trigger_build(args.release)?; - if !build_status.success() { - bail!("failed to build project"); - } - - // Request an install to device - let install_status = android_cli::install_apk(args.release)?; - if !install_status.success() { - bail!("failed to install APK"); - } - - // Fetch and deserialize .android - let dot_android = android_cli::get_dot_android() - .ok_or_else(|| anyhow!(".android not found, can't launch activity"))?; - - // Try to launch MainActivity using ADB - let launch_status = - android_cli::launch_activity(dot_android.package_id, dot_android.main_activity_name)?; - if !launch_status.success() { - bail!("failed to launch activity"); - } - - Ok(()) -} +use anyhow::{anyhow, bail, Result}; +use clap::{ArgAction, Parser}; + +#[derive(Parser, Debug)] +pub struct Run { + /// Should build in release mode + #[clap(short, long, default_value="false", action = ArgAction::SetTrue)] + release: bool, +} + +pub fn handle(args: Run) -> Result<()> { + // Trigger a build + let build_status = android_cli::trigger_build(args.release)?; + if !build_status.success() { + bail!("failed to build project"); + } + + // Request an install to device + let install_status = android_cli::install_apk(args.release)?; + if !install_status.success() { + bail!("failed to install APK"); + } + + // Fetch and deserialize .android + let dot_android = android_cli::get_dot_android() + .ok_or_else(|| anyhow!(".android not found, can't launch activity"))?; + + // Try to launch MainActivity using ADB + let launch_status = + android_cli::launch_activity(dot_android.package_id, dot_android.main_activity_name)?; + if !launch_status.success() { + bail!("failed to launch activity"); + } + + Ok(()) +}