Skip to content

Commit

Permalink
build: address clippy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
chadoh committed Oct 9, 2023
1 parent 15031c8 commit 9ec6baf
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cmd/crates/soroban-spec-tools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ impl Spec {
let v: u128 = int
.clone()
.try_into()
.map_err(|_| Error::InvalidValue(Some(ScType::U128)))?;
.map_err(|()| Error::InvalidValue(Some(ScType::U128)))?;
Value::String(v.to_string())
}

Expand All @@ -705,7 +705,7 @@ impl Spec {
let v: i128 = int
.clone()
.try_into()
.map_err(|_| Error::InvalidValue(Some(ScType::I128)))?;
.map_err(|()| Error::InvalidValue(Some(ScType::I128)))?;
Value::String(v.to_string())
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-cli/src/commands/config/locator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ impl KeyType {
pub fn list_paths(&self, paths: &[Location]) -> Result<Vec<(String, Location)>, Error> {
Ok(paths
.iter()
.flat_map(|p| self.list(p).unwrap_or(vec![]))
.flat_map(|p| self.list(p).unwrap_or_default())
.collect())
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-cli/src/commands/contract/invoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl Cmd {
let contract_address_arg = ScAddress::Contract(Hash(contract_id));
let function_symbol_arg = function
.try_into()
.map_err(|_| Error::FunctionNameTooLong(function.clone()))?;
.map_err(|()| Error::FunctionNameTooLong(function.clone()))?;

let final_args =
parsed_args
Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl Root {
}
match e.kind() {
ErrorKind::InvalidSubcommand => match plugin::run() {
Ok(_) => Error::Clap(e),
Ok(()) => Error::Clap(e),
Err(e) => Error::Plugin(e),
},
_ => Error::Clap(e),
Expand Down
11 changes: 6 additions & 5 deletions cmd/soroban-cli/src/rpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,14 +494,15 @@ impl Client {
}

pub async fn verify_network_passphrase(&self, expected: Option<&str>) -> Result<String, Error> {
let server = self.get_network().await?.passphrase;
if expected.is_some() && expected != Some(&server) {
let actual = self.get_network().await?.passphrase;
let expected = expected.unwrap();
if expected != actual {
return Err(Error::InvalidNetworkPassphrase {
expected: expected.unwrap().to_string(),
server,
expected: expected.to_string(),
server: actual,
});
}
Ok(server)
Ok(actual)
}

pub async fn get_network(&self) -> Result<GetNetworkResponse, Error> {
Expand Down

0 comments on commit 9ec6baf

Please sign in to comment.