From 5fe839e2bf8ceb2931c1984efb2d956980431203 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Mon, 16 Dec 2024 07:58:54 +0000 Subject: chore: nix flake update update nix dependancies to latest version using default update options fix warning related to idomatic patterns --- src/bin/git_remote_nostr/fetch.rs | 17 +++++++++++------ src/bin/git_remote_nostr/push.rs | 13 +++++++------ src/bin/git_remote_nostr/utils.rs | 2 +- 3 files changed, 19 insertions(+), 13 deletions(-) (limited to 'src/bin/git_remote_nostr') diff --git a/src/bin/git_remote_nostr/fetch.rs b/src/bin/git_remote_nostr/fetch.rs index 90387f3..458c6d8 100644 --- a/src/bin/git_remote_nostr/fetch.rs +++ b/src/bin/git_remote_nostr/fetch.rs @@ -141,9 +141,11 @@ async fn fetch_proposals( let current_user = get_curent_user(git_repo)?; for refstr in proposal_refs.keys() { - if let Some((_, (_, patches))) = - find_proposal_and_patches_by_branch_name(refstr, &open_proposals, ¤t_user) - { + if let Some((_, (_, patches))) = find_proposal_and_patches_by_branch_name( + refstr, + &open_proposals, + current_user.as_ref(), + ) { if let Err(error) = make_commits_for_proposal(git_repo, repo_ref, patches) { term.write_line( format!("WARNING: failed to create branch for {refstr}, error: {error}",) @@ -234,7 +236,7 @@ pub fn fetch_from_git_server( fn report_on_transfer_progress( progress_stats: &Progress<'_>, start_time: &Instant, - end_time: &Option, + end_time: Option<&Instant>, ) -> Vec { let mut report = vec![]; let total = progress_stats.total_objects() as f64; @@ -378,8 +380,11 @@ impl<'a> FetchReporter<'a> { self.start_time = Some(Instant::now()); } let existing_lines = self.just_count_transfer_progress(); - let updated = - report_on_transfer_progress(progress_stats, &self.start_time.unwrap(), &self.end_time); + let updated = report_on_transfer_progress( + progress_stats, + &self.start_time.unwrap(), + self.end_time.as_ref(), + ); if self.transfer_progress_msgs.len() <= updated.len() { if self.end_time.is_none() && updated.first().is_some_and(|f| f.contains("100%")) { self.end_time = Some(Instant::now()); diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs index 48122e3..f2ac169 100644 --- a/src/bin/git_remote_nostr/push.rs +++ b/src/bin/git_remote_nostr/push.rs @@ -299,7 +299,7 @@ async fn process_proposal_refspecs( let tip_of_pushed_branch = git_repo.get_commit_or_tip_of_reference(from)?; if let Some((_, (proposal, patches))) = - find_proposal_and_patches_by_branch_name(to, &all_proposals, ¤t_user) + find_proposal_and_patches_by_branch_name(to, &all_proposals, current_user.as_ref()) { if [repo_ref.maintainers.clone(), vec![proposal.pubkey]] .concat() @@ -576,7 +576,7 @@ fn report_on_transfer_progress( total: usize, bytes: usize, start_time: &Instant, - end_time: &Option, + end_time: Option<&Instant>, ) -> Option { if total == 0 { return None; @@ -688,7 +688,7 @@ impl<'a> PushReporter<'a> { total, bytes, &self.start_time.unwrap(), - &self.end_time, + self.end_time.as_ref(), ) { let existing_lines = self.count_all_existing_lines(); if report.contains("100%") { @@ -1215,11 +1215,12 @@ async fn create_merge_events( signer, repo_ref, &proposal, - &if let Some(revision_id) = revision_id { + if let Some(revision_id) = revision_id { Some(get_event_from_cache_by_id(git_repo, revision_id).await?) } else { None - }, + } + .as_ref(), if let Some((commit, _)) = merged_patches .iter() .find(|(_, m)| **m == MergedPRCommitType::MergeCommit) @@ -1263,7 +1264,7 @@ async fn create_merge_status( signer: &Arc, repo_ref: &RepoRef, proposal: &Event, - revision: &Option, + revision: Option<&Event>, merge_commits: Vec, merged_patches: Vec, applied: bool, diff --git a/src/bin/git_remote_nostr/utils.rs b/src/bin/git_remote_nostr/utils.rs index 5efb6e0..8e89652 100644 --- a/src/bin/git_remote_nostr/utils.rs +++ b/src/bin/git_remote_nostr/utils.rs @@ -188,7 +188,7 @@ pub async fn get_all_proposals( pub fn find_proposal_and_patches_by_branch_name<'a>( refstr: &'a str, open_proposals: &'a HashMap)>, - current_user: &Option, + current_user: Option<&PublicKey>, ) -> Option<(&'a EventId, &'a (Event, Vec))> { open_proposals.iter().find(|(_, (proposal, _))| { is_event_proposal_root_for_branch(proposal, refstr, current_user).unwrap_or(false) -- cgit v1.2.3