From a744f4aae9ffee9dd246090bef486b09433778d0 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 2 May 2025 14:37:14 +0100 Subject: chore: nix flake update update nix dependancies to latest version using default update options run `cargo clippy --fix` and `cargo fmt` to fix new clippy errors --- src/bin/ngit/sub_commands/export_keys.rs | 7 +------ src/bin/ngit/sub_commands/init.rs | 14 ++------------ src/bin/ngit/sub_commands/login.rs | 7 +------ src/bin/ngit/sub_commands/logout.rs | 7 +------ 4 files changed, 5 insertions(+), 30 deletions(-) (limited to 'src/bin/ngit/sub_commands') diff --git a/src/bin/ngit/sub_commands/export_keys.rs b/src/bin/ngit/sub_commands/export_keys.rs index 45b1b89..4a32a3a 100644 --- a/src/bin/ngit/sub_commands/export_keys.rs +++ b/src/bin/ngit/sub_commands/export_keys.rs @@ -12,12 +12,7 @@ use crate::git::Repo; pub async fn launch() -> Result<()> { let git_repo_result = Repo::discover().context("failed to find a git repository"); - let git_repo = { - match git_repo_result { - Ok(git_repo) => Some(git_repo), - Err(_) => None, - } - }; + let git_repo = { git_repo_result.ok() }; if let Ok((signer_info, source)) = get_signer_info(&git_repo.as_ref(), &None, &None, &None) { if let Ok((_, user_ref, source)) = load_existing_login( diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs index 9c544d6..3c58a52 100644 --- a/src/bin/ngit/sub_commands/init.rs +++ b/src/bin/ngit/sub_commands/init.rs @@ -70,21 +70,11 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { let mut client = Client::default(); - let repo_coordinate = if let Ok(repo_coordinate) = - try_and_get_repo_coordinates_when_remote_unknown(&git_repo).await - { - Some(repo_coordinate) - } else { - None - }; + let repo_coordinate = (try_and_get_repo_coordinates_when_remote_unknown(&git_repo).await).ok(); let repo_ref = if let Some(repo_coordinate) = &repo_coordinate { fetching_with_report(git_repo_path, &client, repo_coordinate).await?; - if let Ok(repo_ref) = get_repo_ref_from_cache(Some(git_repo_path), repo_coordinate).await { - Some(repo_ref) - } else { - None - } + (get_repo_ref_from_cache(Some(git_repo_path), repo_coordinate).await).ok() } else { None }; diff --git a/src/bin/ngit/sub_commands/login.rs b/src/bin/ngit/sub_commands/login.rs index 06236ec..e76a089 100644 --- a/src/bin/ngit/sub_commands/login.rs +++ b/src/bin/ngit/sub_commands/login.rs @@ -32,12 +32,7 @@ pub async fn launch(args: &Cli, command_args: &SubCommandArgs) -> Result<()> { }; let git_repo_result = Repo::discover().context("failed to find a git repository"); - let git_repo = { - match git_repo_result { - Ok(git_repo) => Some(git_repo), - Err(_) => None, - } - }; + let git_repo = { git_repo_result.ok() }; let (logged_out, log_in_locally_only) = logout(git_repo.as_ref(), command_args.local).await?; if logged_out || log_in_locally_only { diff --git a/src/bin/ngit/sub_commands/logout.rs b/src/bin/ngit/sub_commands/logout.rs index 2df96c8..da445b4 100644 --- a/src/bin/ngit/sub_commands/logout.rs +++ b/src/bin/ngit/sub_commands/logout.rs @@ -11,12 +11,7 @@ use crate::{ pub async fn launch() -> Result<()> { let git_repo_result = Repo::discover().context("failed to find a git repository"); - let git_repo = { - match git_repo_result { - Ok(git_repo) => Some(git_repo), - Err(_) => None, - } - }; + let git_repo = { git_repo_result.ok() }; logout(git_repo.as_ref()).await } -- cgit v1.2.3