Skip to content

Commit 87f0bea

Browse files
doublegateclaude
andcommitted
style(format): apply cargo fmt to all ProRT-IP crates
Apply consistent Rust formatting across all ProRT-IP crates per rustfmt rules. Changes: - Trailing commas in match arms - Consistent formatting in all crates (cli, core, network, scanner, tui) Files affected: - 84 files formatted (no functional changes) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c97ce05 commit 87f0bea

File tree

84 files changed

+608
-608
lines changed

Some content is hidden

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

84 files changed

+608
-608
lines changed

crates/prtip-cli/src/args.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,20 +1319,20 @@ impl Args {
13191319
Hint: Remove -6 flag to scan IPv4 targets, or use --dual-stack for mixed scanning",
13201320
addr
13211321
);
1322-
}
1322+
},
13231323
(IpAddr::V6(addr), IpVersion::V4Only) => {
13241324
anyhow::bail!(
13251325
"Error: IPv6 target '{}' specified with -4 (IPv4-only mode)\n\
13261326
Hint: Remove -4 flag to scan IPv6 targets, or use --dual-stack for mixed scanning",
13271327
addr
13281328
);
1329-
}
1329+
},
13301330
(_, IpVersion::DualStack) => {
13311331
// Accept all targets in dual-stack mode
1332-
}
1332+
},
13331333
_ => {
13341334
// Correct protocol for mode
1335-
}
1335+
},
13361336
}
13371337
}
13381338

@@ -1584,7 +1584,7 @@ impl Args {
15841584
));
15851585
}
15861586
ScanType::Idle
1587-
}
1587+
},
15881588
}
15891589
};
15901590

@@ -2396,7 +2396,7 @@ mod tests {
23962396
DecoyConfig::Random { count, me_position } => {
23972397
assert_eq!(count, 5);
23982398
assert_eq!(me_position, None); // ME appended by default
2399-
}
2399+
},
24002400
_ => panic!("Expected Random variant"),
24012401
}
24022402
}
@@ -2422,7 +2422,7 @@ mod tests {
24222422
assert_eq!(ips.len(), 1);
24232423
assert_eq!(ips[0], Ipv4Addr::new(192, 168, 1, 5));
24242424
assert_eq!(me_position, None);
2425-
}
2425+
},
24262426
_ => panic!("Expected Manual variant"),
24272427
}
24282428
}
@@ -2444,7 +2444,7 @@ mod tests {
24442444
assert_eq!(ips[0], Ipv4Addr::new(192, 168, 1, 5));
24452445
assert_eq!(ips[1], Ipv4Addr::new(192, 168, 1, 10));
24462446
assert_eq!(ips[2], Ipv4Addr::new(192, 168, 1, 15));
2447-
}
2447+
},
24482448
_ => panic!("Expected Manual variant"),
24492449
}
24502450
}
@@ -2464,7 +2464,7 @@ mod tests {
24642464
DecoyConfig::Manual { ips, me_position } => {
24652465
assert_eq!(ips.len(), 2);
24662466
assert_eq!(me_position, Some(0)); // ME at position 0
2467-
}
2467+
},
24682468
_ => panic!("Expected Manual variant"),
24692469
}
24702470
}
@@ -2484,7 +2484,7 @@ mod tests {
24842484
DecoyConfig::Manual { ips, me_position } => {
24852485
assert_eq!(ips.len(), 2);
24862486
assert_eq!(me_position, Some(1)); // ME at position 1 (middle)
2487-
}
2487+
},
24882488
_ => panic!("Expected Manual variant"),
24892489
}
24902490
}
@@ -2504,7 +2504,7 @@ mod tests {
25042504
DecoyConfig::Manual { ips, me_position } => {
25052505
assert_eq!(ips.len(), 2);
25062506
assert_eq!(me_position, Some(2)); // ME at position 2 (last)
2507-
}
2507+
},
25082508
_ => panic!("Expected Manual variant"),
25092509
}
25102510
}

crates/prtip-cli/src/confirm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl ConfirmationManager {
125125
|| (segments[0] >= 0xfc00 && segments[0] <= 0xfdff) // unique local
126126
|| ipv6 == std::net::Ipv6Addr::LOCALHOST;
127127
!is_private
128-
}
128+
},
129129
};
130130

131131
// Or check for large CIDR ranges (> /16 for IPv4, > /48 for IPv6)
@@ -329,7 +329,7 @@ fn estimate_target_count(targets: &[ScanTarget]) -> usize {
329329
} else {
330330
1 << (32 - prefix)
331331
}
332-
}
332+
},
333333
IpAddr::V6(_) => {
334334
// IPv6: For /64 and larger, estimate based on typical scan patterns
335335
// Full IPv6 ranges are impractically large, so we estimate conservatively
@@ -343,7 +343,7 @@ fn estimate_target_count(targets: &[ScanTarget]) -> usize {
343343
// Larger than /48: cap at 1M hosts for estimation
344344
1_000_000
345345
}
346-
}
346+
},
347347
}
348348
})
349349
.sum()

crates/prtip-cli/src/main.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ fn preprocess_argv() -> Vec<String> {
107107
if i < args.len() {
108108
processed.push(args[i].clone());
109109
}
110-
}
110+
},
111111

112112
// Output format flags (with value)
113113
"-oN" => {
@@ -116,28 +116,28 @@ fn preprocess_argv() -> Vec<String> {
116116
if i < args.len() {
117117
processed.push(args[i].clone());
118118
}
119-
}
119+
},
120120
"-oX" => {
121121
processed.push("--output-xml".to_string());
122122
i += 1;
123123
if i < args.len() {
124124
processed.push(args[i].clone());
125125
}
126-
}
126+
},
127127
"-oG" => {
128128
processed.push("--output-greppable".to_string());
129129
i += 1;
130130
if i < args.len() {
131131
processed.push(args[i].clone());
132132
}
133-
}
133+
},
134134
"-oA" => {
135135
processed.push("--output-all-formats".to_string());
136136
i += 1;
137137
if i < args.len() {
138138
processed.push(args[i].clone());
139139
}
140-
}
140+
},
141141

142142
// Skip ping flag
143143
"-Pn" => processed.push("--skip-ping".to_string()),
@@ -204,7 +204,7 @@ async fn run() -> Result<()> {
204204
match db_cmd.command {
205205
DbSubcommand::List { db_path } => {
206206
db_commands::handle_list(db_path).await?;
207-
}
207+
},
208208
DbSubcommand::Query {
209209
db_path,
210210
scan_id,
@@ -214,22 +214,22 @@ async fn run() -> Result<()> {
214214
open,
215215
} => {
216216
db_commands::handle_query(db_path, scan_id, target, port, service, open).await?;
217-
}
217+
},
218218
DbSubcommand::Export {
219219
db_path,
220220
scan_id,
221221
format,
222222
output,
223223
} => {
224224
db_commands::handle_export(db_path, scan_id, format, output).await?;
225-
}
225+
},
226226
DbSubcommand::Compare {
227227
db_path,
228228
scan_id_1,
229229
scan_id_2,
230230
} => {
231231
db_commands::handle_compare(db_path, scan_id_1, scan_id_2).await?;
232-
}
232+
},
233233
}
234234

235235
return Ok(());
@@ -294,30 +294,30 @@ async fn run() -> Result<()> {
294294
match adjust_and_get_limit(Some(requested_ulimit)) {
295295
Ok(new_limit) => {
296296
info!("Successfully adjusted ulimit to {}", new_limit);
297-
}
297+
},
298298
Err(e) => {
299299
warn!("Failed to adjust ulimit to {}: {}", requested_ulimit, e);
300300
warn!(
301301
"Continuing with current ulimit. You may need to run 'ulimit -n {}' manually.",
302302
requested_ulimit
303303
);
304-
}
304+
},
305305
}
306306
}
307307

308308
// Check privileges (needed for raw sockets in future phases)
309309
match check_privileges() {
310310
Ok(()) => {
311311
info!("Privilege check passed");
312-
}
312+
},
313313
Err(e) => {
314314
warn!(
315315
"Insufficient privileges for raw sockets: {}. Using TCP connect scan fallback.",
316316
e
317317
);
318318
// For Phase 1, we only have TCP connect scan, so this is OK
319319
// In future phases, raw socket scans will require privileges
320-
}
320+
},
321321
}
322322

323323
// Parse targets
@@ -476,14 +476,14 @@ async fn run() -> Result<()> {
476476
config.performance.batch_size = Some(recommended as usize);
477477
info!("Using recommended batch size: {}", recommended);
478478
}
479-
}
479+
},
480480
Err(e) => {
481481
warn!("Failed to calculate recommended batch size: {}", e);
482482
if config.performance.batch_size.is_none() {
483483
config.performance.batch_size = Some(1000);
484484
info!("Using default batch size: 1000");
485485
}
486-
}
486+
},
487487
}
488488

489489
// Check for dangerous operations and confirm if needed
@@ -538,12 +538,12 @@ async fn run() -> Result<()> {
538538
Ok(writer) => {
539539
info!("PCAPNG packet capture enabled: {:?}", pcap_path);
540540
Some(Arc::new(std::sync::Mutex::new(writer)))
541-
}
541+
},
542542
Err(e) => {
543543
eprintln!("Error creating PCAPNG writer: {}", e);
544544
eprintln!("Hint: Ensure the directory exists and you have write permissions.");
545545
return Err(e);
546-
}
546+
},
547547
}
548548
} else {
549549
None
@@ -668,10 +668,10 @@ async fn run() -> Result<()> {
668668
.context(format!("Failed to write output to {:?}", path))?;
669669
println!("\nResults written to: {:?}", path);
670670
println!("Total results: {}", results.len());
671-
}
671+
},
672672
None => {
673673
println!("{}", formatted);
674-
}
674+
},
675675
}
676676

677677
// Print summary with scan statistics
@@ -1525,35 +1525,35 @@ mod tests {
15251525
if i < args_vec.len() {
15261526
processed.push(args_vec[i].clone());
15271527
}
1528-
}
1528+
},
15291529
"-oN" => {
15301530
processed.push("--output-normal".to_string());
15311531
i += 1;
15321532
if i < args_vec.len() {
15331533
processed.push(args_vec[i].clone());
15341534
}
1535-
}
1535+
},
15361536
"-oX" => {
15371537
processed.push("--output-xml".to_string());
15381538
i += 1;
15391539
if i < args_vec.len() {
15401540
processed.push(args_vec[i].clone());
15411541
}
1542-
}
1542+
},
15431543
"-oG" => {
15441544
processed.push("--output-greppable".to_string());
15451545
i += 1;
15461546
if i < args_vec.len() {
15471547
processed.push(args_vec[i].clone());
15481548
}
1549-
}
1549+
},
15501550
"-oA" => {
15511551
processed.push("--output-all-formats".to_string());
15521552
i += 1;
15531553
if i < args_vec.len() {
15541554
processed.push(args_vec[i].clone());
15551555
}
1556-
}
1556+
},
15571557
"-Pn" => processed.push("--skip-ping".to_string()),
15581558
_ => processed.push(arg.clone()),
15591559
}

crates/prtip-cli/src/progress.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -816,19 +816,19 @@ impl ProgressDisplay {
816816
match event {
817817
ScanEvent::ScanStarted { .. } => {
818818
Self::display_started(&aggregator, &style, is_tty).await;
819-
}
819+
},
820820
ScanEvent::ProgressUpdate { .. }
821821
| ScanEvent::PortFound { .. }
822822
| ScanEvent::ServiceDetected { .. } => {
823823
Self::display_progress(&aggregator, &style, &progress_bar, is_tty).await;
824-
}
824+
},
825825
ScanEvent::ScanCompleted { .. } => {
826826
Self::display_completed(&aggregator, &style, &progress_bar, is_tty).await;
827-
}
827+
},
828828
ScanEvent::ScanError { error, .. } => {
829829
Self::display_error(&error, is_tty);
830-
}
831-
_ => {}
830+
},
831+
_ => {},
832832
}
833833
}
834834
})
@@ -851,17 +851,17 @@ impl ProgressDisplay {
851851
match style {
852852
ProgressStyle::Compact => {
853853
println!("Scan started: {} targets", total);
854-
}
854+
},
855855
ProgressStyle::Detailed => {
856856
println!("╔════════════════════════════════════════╗");
857857
println!("║ Scan Started ║");
858858
println!("╠════════════════════════════════════════╣");
859859
println!("║ Targets: {:>28} ║", format_number(total as u64));
860860
println!("╚════════════════════════════════════════╝");
861-
}
861+
},
862862
ProgressStyle::Bars => {
863863
println!("Starting scan: {} targets...", total);
864-
}
864+
},
865865
}
866866
}
867867

@@ -891,7 +891,7 @@ impl ProgressDisplay {
891891
state.overall_progress, state.open_ports
892892
);
893893
}
894-
}
894+
},
895895
ProgressStyle::Detailed => {
896896
if is_tty {
897897
print!("\x1b[4A\x1b[J"); // Clear 4 lines
@@ -908,7 +908,7 @@ impl ProgressDisplay {
908908
println!("ETA: Calculating...");
909909
}
910910
let _ = io::stdout().flush();
911-
}
911+
},
912912
ProgressStyle::Bars => {
913913
if is_tty {
914914
print!("\x1b[2A\x1b[J"); // Clear 2 lines
@@ -924,7 +924,7 @@ impl ProgressDisplay {
924924
Self::format_eta(state.eta)
925925
);
926926
let _ = io::stdout().flush();
927-
}
927+
},
928928
}
929929
}
930930

0 commit comments

Comments
 (0)