Skip to content

Commit 2f6c7ce

Browse files
fix: correct syntax in conditional expressions and pattern matching
1 parent c15d212 commit 2f6c7ce

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/main.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
522522
};
523523

524524
// Create disk configuration if both disk params are provided
525-
let disk_config = if rpc_matches
526-
.is_present("ledger-disk" && rpc_matches.is_present("accounts-disk"))
525+
let disk_config = if rpc_matches.is_present("ledger-disk")
526+
&& rpc_matches.is_present("accounts-disk")
527527
{
528528
Some(ssh_deploy::DiskConfig {
529529
ledger_disk: rpc_matches.value_of("ledger-disk").unwrap().to_string(),
@@ -644,7 +644,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
644644

645645
println!("Sonic RPC node deployed successfully!");
646646
}
647-
"solana" => {
647+
("solana", Some(rpc_sub_matches)) => {
648648
// Use the enhanced Solana deployment via rpc subcommand
649649
let connection_str = rpc_sub_matches
650650
.get_one::<String>("connection")
@@ -768,10 +768,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
768768
exit(1);
769769
}
770770
}
771-
"new_feature_command" => {
771+
("new_feature_command", _) => {
772772
println!("Expected output for new feature");
773773
}
774-
cmd => {
774+
(cmd, _) => {
775775
eprintln!("Unknown command: {}", cmd);
776776
exit(1);
777777
}
@@ -808,4 +808,4 @@ mod test {
808808
// Assert that the deserialized data matches the original
809809
assert_eq!(faux, in_faux);
810810
}
811-
}
811+
}

src/utils/clap_compat.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use clap::ArgMatches;
55

66
/// Get a string value from ArgMatches (compatibility with older Clap API)
7-
pub fn value_of(matches: &ArgMatches, name: &str) -> Option<&str> {
7+
pub fn value_of<'a>(matches: &'a ArgMatches, name: &str) -> Option<&'a str> {
88
matches.get_one::<String>(name).map(|s| s.as_str())
99
}
1010

@@ -19,14 +19,14 @@ pub fn occurrences_of(matches: &ArgMatches, name: &str) -> u8 {
1919
}
2020

2121
/// Get a value from ArgMatches and unwrap it (compatibility with older Clap API)
22-
pub fn value_of_unwrap(matches: &ArgMatches, name: &str) -> &str {
22+
pub fn value_of_unwrap<'a>(matches: &'a ArgMatches, name: &str) -> &'a str {
2323
value_of(matches, name).unwrap()
2424
}
2525

2626
/// Get a value from ArgMatches with a default (compatibility with older Clap API)
27-
pub fn value_of_or<'a, 'b>(matches: &'a ArgMatches, name: &str, default: &'b str) -> &'a str
27+
pub fn value_of_or<'a, 'b>(matches: &'a ArgMatches, name: &str, default: &'b str) -> &'a str
2828
where
2929
'b: 'a,
3030
{
3131
value_of(matches, name).unwrap_or(default)
32-
}
32+
}

0 commit comments

Comments
 (0)