diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-01 14:31:32 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-01 15:22:38 +0000 |
| commit | d2ac69816567f092fe0d4661723bc43778cb481b (patch) | |
| tree | e8b51b61a6a7b0ab1a214adebe4e237143b01f0b /src/nostr/builder.rs | |
| parent | 7a78815e29b01c83f3d0ec195ba717a2eba8cd37 (diff) | |
fix cargo clippy and fmt warnings
Diffstat (limited to 'src/nostr/builder.rs')
| -rw-r--r-- | src/nostr/builder.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nostr/builder.rs b/src/nostr/builder.rs index 8e9926a..97fd17e 100644 --- a/src/nostr/builder.rs +++ b/src/nostr/builder.rs | |||
| @@ -51,7 +51,7 @@ impl Nip34WritePolicy { | |||
| 51 | /// Create a bare git repository if it doesn't exist | 51 | /// Create a bare git repository if it doesn't exist |
| 52 | /// Path format: <git_data_path>/<npub>/<identifier>.git | 52 | /// Path format: <git_data_path>/<npub>/<identifier>.git |
| 53 | fn ensure_bare_repository(&self, announcement: &RepositoryAnnouncement) -> Result<(), String> { | 53 | fn ensure_bare_repository(&self, announcement: &RepositoryAnnouncement) -> Result<(), String> { |
| 54 | let repo_path = self.git_data_path.join(&announcement.repo_path()); | 54 | let repo_path = self.git_data_path.join(announcement.repo_path()); |
| 55 | 55 | ||
| 56 | // Check if repository already exists | 56 | // Check if repository already exists |
| 57 | if repo_path.exists() { | 57 | if repo_path.exists() { |
| @@ -69,7 +69,7 @@ impl Nip34WritePolicy { | |||
| 69 | 69 | ||
| 70 | // Initialize bare repository using git command | 70 | // Initialize bare repository using git command |
| 71 | let output = std::process::Command::new("git") | 71 | let output = std::process::Command::new("git") |
| 72 | .args(&["init", "--bare", repo_path.to_str().unwrap()]) | 72 | .args(["init", "--bare", repo_path.to_str().unwrap()]) |
| 73 | .output() | 73 | .output() |
| 74 | .map_err(|e| format!("Failed to execute git init: {}", e))?; | 74 | .map_err(|e| format!("Failed to execute git init: {}", e))?; |
| 75 | 75 | ||
| @@ -482,7 +482,7 @@ impl Nip34WritePolicy { | |||
| 482 | }; | 482 | }; |
| 483 | 483 | ||
| 484 | // Build repository path | 484 | // Build repository path |
| 485 | let repo_path = self.git_data_path.join(&announcement.repo_path()); | 485 | let repo_path = self.git_data_path.join(announcement.repo_path()); |
| 486 | 486 | ||
| 487 | // Validate the ref | 487 | // Validate the ref |
| 488 | match git::validate_nostr_ref(&repo_path, &event_id, &expected_commit) { | 488 | match git::validate_nostr_ref(&repo_path, &event_id, &expected_commit) { |
| @@ -631,8 +631,8 @@ impl Nip34WritePolicy { | |||
| 631 | let kind_u16 = event.kind.as_u16(); | 631 | let kind_u16 = event.kind.as_u16(); |
| 632 | 632 | ||
| 633 | // Check if this is any kind of replaceable event | 633 | // Check if this is any kind of replaceable event |
| 634 | let is_regular_replaceable = kind_u16 >= 10000 && kind_u16 < 20000; | 634 | let is_regular_replaceable = (10000..20000).contains(&kind_u16); |
| 635 | let is_parameterized_replaceable = kind_u16 >= 30000 && kind_u16 < 40000; | 635 | let is_parameterized_replaceable = (30000..40000).contains(&kind_u16); |
| 636 | 636 | ||
| 637 | if is_regular_replaceable || is_parameterized_replaceable { | 637 | if is_regular_replaceable || is_parameterized_replaceable { |
| 638 | // Build the appropriate address format based on event type | 638 | // Build the appropriate address format based on event type |
| @@ -669,7 +669,7 @@ impl Nip34WritePolicy { | |||
| 669 | ]; | 669 | ]; |
| 670 | 670 | ||
| 671 | for tag_type in &addressable_tags { | 671 | for tag_type in &addressable_tags { |
| 672 | let filter = Filter::new().custom_tag(tag_type.clone(), address.clone()); | 672 | let filter = Filter::new().custom_tag(*tag_type, address.clone()); |
| 673 | 673 | ||
| 674 | match database.query(filter).await { | 674 | match database.query(filter).await { |
| 675 | Ok(events) => { | 675 | Ok(events) => { |
| @@ -691,7 +691,7 @@ impl Nip34WritePolicy { | |||
| 691 | ]; | 691 | ]; |
| 692 | 692 | ||
| 693 | for tag_type in &event_id_tags { | 693 | for tag_type in &event_id_tags { |
| 694 | let filter = Filter::new().custom_tag(tag_type.clone(), event_id_hex.clone()); | 694 | let filter = Filter::new().custom_tag(*tag_type, event_id_hex.clone()); |
| 695 | 695 | ||
| 696 | match database.query(filter).await { | 696 | match database.query(filter).await { |
| 697 | Ok(events) => { | 697 | Ok(events) => { |