Skip to content

Commit 28a66bb

Browse files
Fix clippy warnings and WiX installer issues
- Fix WiX installer XML structure by moving Publish elements inside UI element - Auto-fix clippy warnings with cargo clippy --fix - Resolve redundant closures, pattern matching, and other clippy issues - Fix thread_local initialization and other compilation warnings - Ensure CI formatting and clippy checks pass
1 parent 4ea2c52 commit 28a66bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+231
-226
lines changed

src/cli/commands/add.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
//! Add command implementation
22
33
use crate::cli::commands::find_repository_root;
4-
use crate::ignore::scanner::{FilteredFileScanner, ScanPhase};
4+
use crate::ignore::scanner::FilteredFileScanner;
55
use crate::storage::parallel_processor::add_all_parallel;
66
use crate::storage::store::Store;
77
use anyhow::Result;
88
use colored::Colorize;
99
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
1010
use std::path::PathBuf;
11-
use std::sync::atomic::{AtomicUsize, Ordering};
12-
use std::sync::Arc;
1311

1412
/// Execute the add command
1513
pub fn execute(

src/cli/commands/commit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ fn edit_commit_message(initial_message: &str) -> Result<String> {
113113
// Create temporary file with initial message
114114
let mut temp_file = NamedTempFile::new()?;
115115
writeln!(temp_file, "{}", initial_message)?;
116-
writeln!(temp_file, "")?;
116+
writeln!(temp_file)?;
117117
writeln!(
118118
temp_file,
119119
"# Please enter the commit message for your changes."

src/cli/commands/config.rs

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -145,23 +145,21 @@ pub fn execute(
145145
} else {
146146
println!("{}", value_str);
147147
}
148+
} else if json {
149+
println!(
150+
"{}",
151+
serde_json::json!({
152+
"key": key_str,
153+
"value": null,
154+
"error": "not set"
155+
})
156+
);
148157
} else {
149-
if json {
150-
println!(
151-
"{}",
152-
serde_json::json!({
153-
"key": key_str,
154-
"value": null,
155-
"error": "not set"
156-
})
157-
);
158-
} else {
159-
eprintln!(
160-
"{}",
161-
format!("Configuration key '{}' is not set", key_str).yellow()
162-
);
163-
return Err(anyhow::anyhow!("Configuration key not found"));
164-
}
158+
eprintln!(
159+
"{}",
160+
format!("Configuration key '{}' is not set", key_str).yellow()
161+
);
162+
return Err(anyhow::anyhow!("Configuration key not found"));
165163
}
166164
}
167165
} else {
@@ -204,24 +202,22 @@ fn list_configuration(config: &GlobalConfig, json: bool) -> Result<()> {
204202
if json {
205203
let config_map: std::collections::HashMap<String, String> = entries.into_iter().collect();
206204
println!("{}", serde_json::to_string_pretty(&config_map)?);
205+
} else if entries.is_empty() {
206+
println!("{}", "No configuration values set".yellow());
207+
println!();
208+
println!("{}", "To set configuration:".bold());
209+
println!(" {}", "digstore config user.name \"Your Name\"".cyan());
210+
println!(
211+
" {}",
212+
"digstore config user.email \"your@email.com\"".cyan()
213+
);
207214
} else {
208-
if entries.is_empty() {
209-
println!("{}", "No configuration values set".yellow());
210-
println!();
211-
println!("{}", "To set configuration:".bold());
212-
println!(" {}", "digstore config user.name \"Your Name\"".cyan());
213-
println!(
214-
" {}",
215-
"digstore config user.email \"your@email.com\"".cyan()
216-
);
217-
} else {
218-
println!("{}", "Global Configuration".green().bold());
219-
println!("{}", "═".repeat(40));
220-
println!();
215+
println!("{}", "Global Configuration".green().bold());
216+
println!("{}", "═".repeat(40));
217+
println!();
221218

222-
for (key, value) in entries {
223-
println!("{} = {}", key.bold(), value.cyan());
224-
}
219+
for (key, value) in entries {
220+
println!("{} = {}", key.bold(), value.cyan());
225221
}
226222
}
227223

src/cli/commands/decrypt.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
//! Decrypt command implementation
22
33
use crate::cli::commands::find_repository_root;
4-
use crate::core::types::Hash;
54
use crate::storage::store::Store;
6-
use crate::urn::{parse_urn, Urn};
75
use anyhow::Result;
86
use colored::Colorize;
97
use std::io::Write;

src/cli/commands/get.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
use crate::cli::commands::find_repository_root;
44
use crate::core::types::Hash;
55
use crate::storage::store::Store;
6-
use crate::urn::{parse_urn, Urn};
6+
use crate::urn::parse_urn;
77
use anyhow::Result;
8-
use base64;
98
use colored::Colorize;
109
use sha2::{Digest, Sha256};
1110
use std::io::Write;
@@ -75,7 +74,7 @@ fn generate_deterministic_random_bytes(seed: &str, size: usize) -> Vec<u8> {
7574

7675
while result.len() < size {
7776
let mut current_hasher = hasher.clone();
78-
current_hasher.update(&counter.to_le_bytes());
77+
current_hasher.update(counter.to_le_bytes());
7978
let hash = current_hasher.finalize();
8079

8180
let bytes_needed = size - result.len();

src/cli/commands/keygen.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
//! Key generation command implementation
22
33
use crate::cli::context::CliContext;
4-
use crate::config::GlobalConfig;
5-
use crate::crypto::{derive_key_from_urn, derive_storage_address, transform_urn, PublicKey};
4+
use crate::crypto::{derive_key_from_urn, derive_storage_address, transform_urn};
65
use crate::wallet::WalletManager;
76
use anyhow::Result;
87
use colored::Colorize;
@@ -31,7 +30,7 @@ pub fn execute_with_profile(
3130
println!("{}", "Generating content key...".bright_blue());
3231

3332
// Get wallet profile from CLI context if not provided
34-
let effective_wallet_profile = wallet_profile.or_else(|| CliContext::get_wallet_profile());
33+
let effective_wallet_profile = wallet_profile.or_else(CliContext::get_wallet_profile);
3534

3635
// Get public key from specified wallet profile or active wallet
3736
let public_key =

src/cli/commands/layer/inspect.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use crate::storage::Store;
22
use anyhow::Result;
33
use clap::Args;
44
use colored::Colorize;
5-
use serde_json::json;
65

76
#[derive(Args)]
87
pub struct InspectArgs {

src/cli/commands/layer/list.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,11 @@ pub fn execute(
8181
// Show current layer
8282
if let Some(current_root) = store.current_root() {
8383
analyze_specific_layer(&store, current_root, &args)?;
84+
} else if args.json {
85+
println!("{}", json!({"error": "No current layer found"}));
8486
} else {
85-
if args.json {
86-
println!("{}", json!({"error": "No current layer found"}));
87-
} else {
88-
println!("{}", "No current layer found".yellow());
89-
println!(" {} Use 'digstore commit' to create a layer", "→".cyan());
90-
}
87+
println!("{}", "No current layer found".yellow());
88+
println!(" {} Use 'digstore commit' to create a layer", "→".cyan());
9189
}
9290
}
9391

src/cli/commands/proof/generate.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::core::error::DigstoreError;
2-
use crate::proofs::{Proof, ProofElement, ProofMetadata, ProofPosition, ProofTarget};
2+
use crate::proofs::{Proof, ProofPosition};
33
use crate::storage::Store;
44
use crate::urn::parse_urn;
55
use anyhow::Result;
@@ -177,7 +177,7 @@ fn handle_urn_prove(args: &ProveArgs) -> Result<()> {
177177
let root_hash = urn.root_hash.unwrap_or_else(|| {
178178
store
179179
.current_root()
180-
.unwrap_or_else(|| crate::core::types::Hash::zero())
180+
.unwrap_or_else(crate::core::types::Hash::zero)
181181
});
182182
Proof::new_layer_proof(&store, root_hash)?
183183
};
@@ -202,7 +202,7 @@ fn output_proof(proof: &Proof, args: &ProveArgs) -> Result<()> {
202202
"binary" => {
203203
// Serialize proof to binary format using bincode
204204
bincode::serialize(proof)
205-
.map_err(|e| DigstoreError::Serialization(e))?
205+
.map_err(DigstoreError::Serialization)?
206206
.into_iter()
207207
.map(|b| b as char)
208208
.collect::<String>()

src/cli/commands/proof/generate_archive_size.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22
33
use crate::cli::commands::find_repository_root;
44
use crate::cli::context::CliContext;
5-
use crate::config::global_config::{ConfigKey, ConfigValue, GlobalConfig};
65
use crate::core::digstore_file::DigstoreFile;
76
use crate::core::types::Hash;
87
use crate::proofs::size_proof::ArchiveSizeProof;
98
use crate::storage::{dig_archive::get_archive_path, Store};
109
use crate::wallet::WalletManager;
1110
use anyhow::Result;
1211
use colored::Colorize;
13-
use std::io::Write;
1412
use std::path::PathBuf;
1513

1614
/// Execute the proof generate-archive-size command

0 commit comments

Comments
 (0)