From 092b9606ff2b721d858a5c7b2b27a2f9942b4bc4 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 16 Jul 2025 10:10:41 +0100 Subject: chore: nix flake update required running: `cargo fix --allow-dirty --allow-staged` `cargo clippy --fix --allow-dirty -- -D warnings` to fix problems and then manually fixing some too --- flake.lock | 12 ++++++------ src/lib/client.rs | 3 +-- src/lib/git/mod.rs | 7 ++----- src/lib/git/nostr_url.rs | 8 ++++---- src/lib/login/fresh.rs | 8 ++++---- test_utils/src/lib.rs | 10 +++++----- test_utils/src/relay.rs | 2 +- tests/git_remote_nostr/list.rs | 23 +++++++++++------------ tests/git_remote_nostr/push.rs | 12 ++++++------ tests/ngit_list.rs | 12 ++++-------- tests/ngit_login.rs | 18 ++++++++---------- tests/ngit_send.rs | 3 +-- 12 files changed, 53 insertions(+), 65 deletions(-) diff --git a/flake.lock b/flake.lock index b89753c..6b8a5ab 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1746141548, - "narHash": "sha256-IgBWhX7A2oJmZFIrpRuMnw5RAufVnfvOgHWgIdds+hc=", + "lastModified": 1752480373, + "narHash": "sha256-JHQbm+OcGp32wAsXTE/FLYGNpb+4GLi5oTvCxwSoBOA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f02fddb8acef29a8b32f10a335d44828d7825b78", + "rev": "62e0f05ede1da0d54515d4ea8ce9c733f12d9f08", "type": "github" }, "original": { @@ -62,11 +62,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1746153335, - "narHash": "sha256-vwKelhJJS8haCdH3t8uf96VFao7/YzJahPG5JLTO1PU=", + "lastModified": 1752633862, + "narHash": "sha256-Bj7ozT1+5P7NmvDcuAXJvj56txcXuAhk3Vd9FdWFQzk=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "ebc7823c3ffde594c7733113042b72694d996de9", + "rev": "8668ca94858206ac3db0860a9dec471de0d995f8", "type": "github" }, "original": { diff --git a/src/lib/client.rs b/src/lib/client.rs index 445bf77..16cfe30 100644 --- a/src/lib/client.rs +++ b/src/lib/client.rs @@ -794,8 +794,7 @@ pub async fn sign_event( if signer.backend() == SignerBackend::NostrConnect { let term = console::Term::stderr(); term.write_line(&format!( - "signing event ({}) with remote signer...", - description + "signing event ({description}) with remote signer..." ))?; let event = signer .sign_event(event_builder.build(signer.get_public_key().await?)) diff --git a/src/lib/git/mod.rs b/src/lib/git/mod.rs index 5bdb30a..464990b 100644 --- a/src/lib/git/mod.rs +++ b/src/lib/git/mod.rs @@ -888,7 +888,7 @@ pub fn save_git_config_item(git_repo: &Option<&Repo>, item: &str, value: &str) - git2::Config::open_default()? .open_global()? .set_str(item, value) - .context(format!("failed to set global git config item {}", item)) + .context(format!("failed to set global git config item {item}")) } } @@ -901,10 +901,7 @@ pub fn remove_git_config_item(git_repo: &Option<&Repo>, item: &str) -> Result Relay<'a> { pub fn shutdown_relay(port: u64) -> Result<()> { let mut counter = 0; - while let Ok((mut socket, _)) = tungstenite::connect(format!("ws://localhost:{}", port)) { + while let Ok((mut socket, _)) = tungstenite::connect(format!("ws://localhost:{port}")) { counter += 1; if counter == 1 { socket.write(tungstenite::Message::text("shut me down"))?; diff --git a/tests/git_remote_nostr/list.rs b/tests/git_remote_nostr/list.rs index 37cff30..c201054 100644 --- a/tests/git_remote_nostr/list.rs +++ b/tests/git_remote_nostr/list.rs @@ -41,7 +41,7 @@ mod without_state_announcement { let cli_tester_handle = std::thread::spawn(move || -> Result<()> { let mut p = cli_tester_after_fetch(&git_repo)?; p.send_line("list")?; - p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; + p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; p.expect("list: connecting...\r\n\r\r\r")?; // println!("{}", p.expect_eventually("\r\n\r\n")?); let res = p.expect_eventually("\r\n\r\n")?; @@ -59,8 +59,8 @@ mod without_state_announcement { .collect::>(), HashSet::from([ "@refs/heads/main HEAD".to_string(), - format!("{} refs/heads/main", main_commit_id), - format!("{} refs/heads/vnext", vnext_commit_id), + format!("{main_commit_id} refs/heads/main"), + format!("{vnext_commit_id} refs/heads/vnext"), ]), ); Ok(()) @@ -120,7 +120,7 @@ mod with_state_announcement { let mut p = cli_tester_after_fetch(&git_repo)?; p.send_line("list")?; p.expect( - format!("fetching {} ref list over filesystem...\r\n", source_path).as_str(), + format!("fetching {source_path} ref list over filesystem...\r\n").as_str(), )?; p.expect("list: connecting...\r\n\r\r\r")?; // println!("{}", p.expect_eventually("\r\n\r\n")?); @@ -135,8 +135,8 @@ mod with_state_announcement { .collect::>(), HashSet::from([ "@refs/heads/main HEAD".to_string(), - format!("{} refs/heads/main", main_commit_id), - format!("{} refs/heads/example-branch", example_commit_id), + format!("{main_commit_id} refs/heads/main"), + format!("{example_commit_id} refs/heads/example-branch"), ]), ); @@ -204,13 +204,12 @@ mod with_state_announcement { let mut p = cli_tester_after_fetch(&git_repo)?; p.send_line("list")?; p.expect( - format!("fetching {} ref list over filesystem...\r\n", source_path).as_str(), + format!("fetching {source_path} ref list over filesystem...\r\n").as_str(), )?; p.expect("list: connecting...\r\n\r\r\r")?; p.expect( format!( - "WARNING: {} refs/heads/main is out of sync with nostr \r\n", - source_path + "WARNING: {source_path} refs/heads/main is out of sync with nostr \r\n" ) .as_str(), )?; @@ -231,8 +230,8 @@ mod with_state_announcement { .collect::>(), HashSet::from([ "@refs/heads/main HEAD".to_string(), - format!("{} refs/heads/main", main_original_commit_id), - format!("{} refs/heads/example-branch", example_commit_id), + format!("{main_original_commit_id} refs/heads/main"), + format!("{example_commit_id} refs/heads/example-branch"), ]), ); Ok(()) @@ -292,7 +291,7 @@ mod with_state_announcement { let mut p = cli_tester_after_fetch(&git_repo)?; p.send_line("list")?; p.expect( - format!("fetching {} ref list over filesystem...\r\n", source_path).as_str(), + format!("fetching {source_path} ref list over filesystem...\r\n").as_str(), )?; p.expect("list: connecting...\r\n\r\r\r")?; // println!("{}", p.expect_eventually("\r\n\r\n")?); diff --git a/tests/git_remote_nostr/push.rs b/tests/git_remote_nostr/push.rs index f46b0ea..9f5f492 100644 --- a/tests/git_remote_nostr/push.rs +++ b/tests/git_remote_nostr/push.rs @@ -981,7 +981,7 @@ async fn proposal_three_way_merge_commit_pushed_to_main_leads_to_status_event_is let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); cli_expect_nostr_fetch(&mut p)?; - p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; + p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; p.expect("list: connecting...\r\n")?; p.expect_eventually("merge commit ")?; // shorthand merge commit id appears in this gap @@ -1137,7 +1137,7 @@ async fn proposal_fast_forward_merge_commits_pushed_to_main_leads_to_status_even let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); cli_expect_nostr_fetch(&mut p)?; - p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; + p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; p.expect("list: connecting...\r\n")?; p.expect_eventually(format!( "fast-forward merge: create nostr proposal status event for {branch_name}\r\n" @@ -1323,7 +1323,7 @@ async fn proposal_commits_applied_and_pushed_to_main_leads_to_status_event_issue let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); cli_expect_nostr_fetch(&mut p)?; - p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; + p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; p.expect("list: connecting...\r\n")?; p.expect_eventually(format!( "applied commits from proposal: create nostr proposal status event for {branch_name}\r\n" ))?; @@ -1484,7 +1484,7 @@ async fn push_2_commits_to_existing_proposal() -> Result<()> { let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); cli_expect_nostr_fetch(&mut p)?; - p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; + p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; p.expect("list: connecting...\r\n\r\r\r")?; p.expect_eventually_and_print(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; let output = p.expect_end_eventually()?; @@ -1639,7 +1639,7 @@ async fn force_push_creates_proposal_revision() -> Result<()> { let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push", "--force"]); cli_expect_nostr_fetch(&mut p)?; - p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; + p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; p.expect("list: connecting...\r\n")?; p.expect_eventually_and_print(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; let output = p.expect_end_eventually()?; @@ -1791,7 +1791,7 @@ async fn push_new_pr_branch_creates_proposal() -> Result<()> { branch_name, ]); cli_expect_nostr_fetch(&mut p)?; - p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; + p.expect(format!("fetching {source_path} ref list over filesystem...\r\n").as_str())?; p.expect("list: connecting...\r\n\r\r\r")?; p.expect_eventually_and_print(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; let output = p.expect_end_eventually()?; diff --git a/tests/ngit_list.rs b/tests/ngit_list.rs index bb742cf..c8f761a 100644 --- a/tests/ngit_list.rs +++ b/tests/ngit_list.rs @@ -217,8 +217,7 @@ mod when_main_branch_is_uptodate { ])?; c.succeeds_with(0, true, None)?; p.expect(format!( - "checked out proposal as 'pr/{}(", - FEATURE_BRANCH_NAME_1, + "checked out proposal as 'pr/{FEATURE_BRANCH_NAME_1}(", ))?; p.expect_end_eventually_with(")' branch\r\n")?; @@ -334,8 +333,7 @@ mod when_main_branch_is_uptodate { ])?; c.succeeds_with(0, true, Some(0))?; p.expect(format!( - "checked out proposal as 'pr/{}(", - FEATURE_BRANCH_NAME_3, + "checked out proposal as 'pr/{FEATURE_BRANCH_NAME_3}(", ))?; p.expect_end_eventually_with(")' branch\r\n")?; @@ -530,8 +528,7 @@ mod when_main_branch_is_uptodate { ])?; c.succeeds_with(0, true, Some(0))?; p.expect(format!( - "checked out proposal as 'pr/{}(", - FEATURE_BRANCH_NAME_4, + "checked out proposal as 'pr/{FEATURE_BRANCH_NAME_4}(", ))?; p.expect_end_eventually_with(")' branch\r\n")?; @@ -756,8 +753,7 @@ mod when_main_branch_is_uptodate { ])?; c.succeeds_with(0, true, Some(0))?; p.expect(format!( - "checked out proposal as 'pr/{}(", - FEATURE_BRANCH_NAME_1, + "checked out proposal as 'pr/{FEATURE_BRANCH_NAME_1}(", ))?; p.expect_end_eventually_with(")' branch\r\n")?; diff --git a/tests/ngit_login.rs b/tests/ngit_login.rs index b1e2676..09e40f1 100644 --- a/tests/ngit_login.rs +++ b/tests/ngit_login.rs @@ -110,9 +110,7 @@ mod with_relays { p.expect("failed to extract account name from account metadata...\r\n")?; - p.expect_end_with( - format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str(), - )?; + p.expect_end_with(format!("logged in as {TEST_KEY_1_NPUB}\r\n").as_str())?; for p in [51, 52] { shutdown_relay(8000 + p)?; } @@ -572,7 +570,7 @@ mod with_offline_flag { p.expect("saved login details to local git config. you are only logged in to this local repository.\r\n")?; - p.expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str()) + p.expect_end_with(format!("logged in as {TEST_KEY_1_NPUB}\r\n").as_str()) } #[test] @@ -587,7 +585,7 @@ mod with_offline_flag { p.expect("saved login details to local git config. you are only logged in to this local repository.\r\n")?; - p.expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str()) + p.expect_end_with(format!("logged in as {TEST_KEY_1_NPUB}\r\n").as_str()) } mod when_invalid_nsec { @@ -621,7 +619,7 @@ mod with_offline_flag { p.expect("saved login details to local git config. you are only logged in to this local repository.\r\n")?; - p.expect_end_with(format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str()) + p.expect_end_with(format!("logged in as {TEST_KEY_1_NPUB}\r\n").as_str()) } } } @@ -643,7 +641,7 @@ mod with_offline_flag { p.expect("saved login details to local git config. you are only logged in to this local repository.\r\n")?; p.expect_end_with( - format!("logged in as {} via cli arguments\r\n", TEST_KEY_1_NPUB).as_str(), + format!("logged in as {TEST_KEY_1_NPUB} via cli arguments\r\n").as_str(), ) } @@ -682,7 +680,7 @@ mod with_offline_flag { p.expect("saved login details to local git config. you are only logged in to this local repository.\r\n")?; p.expect_end_with( - format!("logged in as {} via cli arguments\r\n", TEST_KEY_1_NPUB).as_str(), + format!("logged in as {TEST_KEY_1_NPUB} via cli arguments\r\n").as_str(), ) } @@ -701,7 +699,7 @@ mod with_offline_flag { p.expect("saved login details to local git config. you are only logged in to this local repository.\r\n")?; p.expect_end_with( - format!("logged in as {} via cli arguments\r\n", TEST_KEY_1_NPUB).as_str(), + format!("logged in as {TEST_KEY_1_NPUB} via cli arguments\r\n").as_str(), ) } @@ -724,7 +722,7 @@ mod with_offline_flag { p.expect("saved login details to local git config. you are only logged in to this local repository.\r\n")?; p.expect_end_with( - format!("logged in as {} via cli arguments\r\n", TEST_KEY_2_NPUB).as_str(), + format!("logged in as {TEST_KEY_2_NPUB} via cli arguments\r\n").as_str(), ) } } diff --git a/tests/ngit_send.rs b/tests/ngit_send.rs index 0337a6e..5cc5291 100644 --- a/tests/ngit_send.rs +++ b/tests/ngit_send.rs @@ -1361,8 +1361,7 @@ mod root_proposal_specified_using_in_reply_to_with_range_of_head_2_and_cover_let p.expect("updates: 1 new maintainer, 1 announcement update, 1 proposal\r\n")?; let proposal_root_bech32 = get_pretend_proposal_root_event().id.to_bech32().unwrap(); p.expect(format!( - "creating proposal revision for: {}\r\n", - proposal_root_bech32, + "creating proposal revision for: {proposal_root_bech32}\r\n", ))?; p.expect("creating proposal from 2 commits:\r\n")?; p.expect("fe973a8 add t4.md\r\n")?; -- cgit v1.2.3