Skip to content

Commit

Permalink
rust: appease clippy and fmt with after new Rust release (stellar#899)
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal committed Aug 24, 2023
1 parent 90c8a3d commit c98b9c7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions cmd/crates/soroban-spec-json/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pub fn generate_from_wasm(wasm: &[u8]) -> Result<String, FromWasmError> {
Ok(json)
}

/// # Panics
pub fn generate(spec: &[ScSpecEntry]) -> String {
let collected: Vec<_> = spec.iter().map(Entry::from).collect();
serde_json::to_string_pretty(&collected).expect("serialization of the spec entries should not have any failure cases as all keys are strings and the serialize implementations are derived")
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 @@ -547,7 +547,7 @@ fn build_custom_cmd(name: &str, spec: &Spec) -> Result<clap::Command, Error> {
let long_doc: &'static str = Box::leak(arg_file_help(doc).into_boxed_str());

cmd = cmd.about(Some(doc)).long_about(long_doc);
for (name, type_) in inputs_map.iter() {
for (name, type_) in inputs_map {
let mut arg = clap::Arg::new(name);
let file_arg_name = fmt_arg_file_name(name);
let mut file_arg = clap::Arg::new(&file_arg_name);
Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-cli/src/commands/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn short() -> String {
pub fn long() -> String {
let env = soroban_env_host::VERSION;
let xdr = soroban_env_host::VERSION.xdr;
vec![
[
short(),
format!("soroban-env {} ({})", env.pkg, env.rev),
format!("soroban-env interface version {}", meta::INTERFACE_VERSION),
Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-cli/src/log/event.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use soroban_env_host::events::HostEvent;

pub fn events(events: &[HostEvent]) {
for event in events.iter() {
for event in events {
tracing::info!(log = event.to_string());
}
}
6 changes: 3 additions & 3 deletions cmd/soroban-cli/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub fn add_contract_code_to_ledger_entries(
}),
ext: LedgerEntryExt::V0,
};
for (k, e) in entries.iter_mut() {
for (k, e) in &mut *entries {
if **k == code_key {
**e = code_entry;
return Ok(hash);
Expand Down Expand Up @@ -125,7 +125,7 @@ pub fn add_contract_to_ledger_entries(
}),
ext: LedgerEntryExt::V0,
};
for (k, e) in entries.iter_mut() {
for (k, e) in &mut *entries {
if **k == contract_key {
**e = contract_entry;
return;
Expand All @@ -143,7 +143,7 @@ pub fn bump_ledger_entry_expirations(
.iter()
.map(|b| (b.key.as_ref().clone(), b.min_expiration))
.collect::<HashMap<_, _>>();
for (k, e) in entries.iter_mut() {
for (k, e) in &mut *entries {
if let Some(min_expiration) = lookup.get(k.as_ref()) {
if let LedgerEntryData::ContractData(entry) = &mut e.data {
entry.expiration_ledger_seq = *min_expiration;
Expand Down

0 comments on commit c98b9c7

Please sign in to comment.