From df1660b1b78b5881c64c6fadd4ae12c8c01c6684 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 11 Sep 2024 12:52:46 +0100 Subject: refactor: fix fmt and clippy issues which potentially were only identified when a dependancy was updated --- src/lib/client.rs | 2 +- src/lib/git/mod.rs | 6 +----- src/lib/git_events.rs | 2 +- test_utils/src/lib.rs | 2 +- tests/git_remote_nostr/fetch.rs | 1 - tests/git_remote_nostr/list.rs | 1 - tests/ngit/list.rs | 8 ++++---- 7 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/lib/client.rs b/src/lib/client.rs index c29d4b9..455725c 100644 --- a/src/lib/client.rs +++ b/src/lib/client.rs @@ -145,7 +145,7 @@ impl Connect for Client { Client { client: nostr_sdk::ClientBuilder::new() .opts(Options::new().relay_limits(RelayLimits::disable())) - .signer(&opts.keys.unwrap_or(nostr::Keys::generate())) + .signer(opts.keys.unwrap_or(nostr::Keys::generate())) // .database( // SQLiteDatabase::open(get_dirs()?.cache_dir().join("nostr-cache.sqlite")). // await?, ) diff --git a/src/lib/git/mod.rs b/src/lib/git/mod.rs index 72717f7..00d84f6 100644 --- a/src/lib/git/mod.rs +++ b/src/lib/git/mod.rs @@ -685,11 +685,7 @@ impl RepoActions for Repo { /// setting global to None will suppliment local config with global items /// not in local fn get_git_config_item(&self, item: &str, global: Option) -> Result> { - let just_global = if let Some(just_global) = global { - just_global - } else { - false - }; + let just_global = global.unwrap_or(false); match if just_global { self.git_repo .config() diff --git a/src/lib/git_events.rs b/src/lib/git_events.rs index 2e9f797..b4ac676 100644 --- a/src/lib/git_events.rs +++ b/src/lib/git_events.rs @@ -249,7 +249,7 @@ pub fn event_tag_from_nip19_or_hex( loop { if bech32.is_empty() { bech32 = Interactor::default().input( - PromptInputParms::default().with_prompt(&format!("{reference_name} reference")), + PromptInputParms::default().with_prompt(format!("{reference_name} reference")), )?; } if let Ok(nip19) = Nip19::from_bech32(bech32.clone()) { diff --git a/test_utils/src/lib.rs b/test_utils/src/lib.rs index deff86e..be51ed9 100644 --- a/test_utils/src/lib.rs +++ b/test_utils/src/lib.rs @@ -1024,7 +1024,7 @@ where for entry in (std::fs::read_dir(src)?).flatten() { let src_path = entry.path(); if let Some(name) = src_path.file_name() { - let _ = std::fs::copy(&src_path, &git_exec_dir.join(name)); + let _ = std::fs::copy(&src_path, git_exec_dir.join(name)); } } } diff --git a/tests/git_remote_nostr/fetch.rs b/tests/git_remote_nostr/fetch.rs index 9ae17d8..b7415b5 100644 --- a/tests/git_remote_nostr/fetch.rs +++ b/tests/git_remote_nostr/fetch.rs @@ -1,4 +1,3 @@ - use super::*; #[tokio::test] diff --git a/tests/git_remote_nostr/list.rs b/tests/git_remote_nostr/list.rs index 1b12bbd..3858ece 100644 --- a/tests/git_remote_nostr/list.rs +++ b/tests/git_remote_nostr/list.rs @@ -1,4 +1,3 @@ - use super::*; mod without_state_announcement { diff --git a/tests/ngit/list.rs b/tests/ngit/list.rs index c145fa4..26cf717 100644 --- a/tests/ngit/list.rs +++ b/tests/ngit/list.rs @@ -196,7 +196,7 @@ mod when_main_branch_is_uptodate { ], )?; c.succeeds_with(0, false, None)?; - p.expect(&format!( + p.expect(format!( "checked out proposal as 'pr/{}(", FEATURE_BRANCH_NAME_1, ))?; @@ -318,7 +318,7 @@ mod when_main_branch_is_uptodate { ], )?; c.succeeds_with(0, false, Some(0))?; - p.expect(&format!( + p.expect(format!( "checked out proposal as 'pr/{}(", FEATURE_BRANCH_NAME_3, ))?; @@ -525,7 +525,7 @@ mod when_main_branch_is_uptodate { ], )?; c.succeeds_with(0, false, Some(0))?; - p.expect(&format!( + p.expect(format!( "checked out proposal as 'pr/{}(", FEATURE_BRANCH_NAME_4, ))?; @@ -772,7 +772,7 @@ mod when_main_branch_is_uptodate { ], )?; c.succeeds_with(0, false, Some(0))?; - p.expect(&format!( + p.expect(format!( "checked out proposal as 'pr/{}(", FEATURE_BRANCH_NAME_1, ))?; -- cgit v1.2.3