Skip to content

Commit 73e5254

Browse files
committed
Fix warnings raised by rust 1.95.
1 parent 4eec6fb commit 73e5254

12 files changed

Lines changed: 32 additions & 40 deletions

File tree

cmd/crates/soroban-spec-typescript/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ pub fn generate(spec: &[ScSpecEntry]) -> String {
125125
// Filter out function entries with names that start with "__" and partition the results
126126
for entry in &collected {
127127
match entry {
128-
Entry::Function { name, inputs, .. } if name == "__constructor" => {
129-
if !inputs.is_empty() {
130-
constructor_args = Some(inputs.clone());
131-
}
128+
Entry::Function { name, inputs, .. }
129+
if name == "__constructor" && !inputs.is_empty() =>
130+
{
131+
constructor_args = Some(inputs.clone());
132132
}
133133
_ => {}
134134
}

cmd/crates/soroban-test/tests/it/build.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ fn build_no_error_for_package() {
763763
let cargo_toml_path = dir_path.join("Cargo.toml");
764764
let cargo_toml_path_content = std::fs::read_to_string(&cargo_toml_path).unwrap();
765765
let modified_cargo_toml_content =
766-
format!("{cargo_toml_path_content}\n[profile.release]\noverflow-checks = true\n",);
766+
format!("{cargo_toml_path_content}\n[profile.release]\noverflow-checks = true\n");
767767
std::fs::write(&cargo_toml_path, modified_cargo_toml_content).unwrap();
768768

769769
sandbox
@@ -876,7 +876,7 @@ fn build_errors_when_overflow_check_only_applied_to_members() {
876876
let member_cargo_toml_path = dir_path.join("contracts").join("add").join("Cargo.toml");
877877
let member_cargo_toml_content = std::fs::read_to_string(&member_cargo_toml_path).unwrap();
878878
let modified_member_content =
879-
format!("{member_cargo_toml_content}\n[profile.release]\noverflow-checks = true\n",);
879+
format!("{member_cargo_toml_content}\n[profile.release]\noverflow-checks = true\n");
880880
std::fs::write(&member_cargo_toml_path, modified_member_content).unwrap();
881881

882882
// Add overflow-checks = true to "add2" member
@@ -887,7 +887,7 @@ fn build_errors_when_overflow_check_only_applied_to_members() {
887887
.join("Cargo.toml");
888888
let member_2_cargo_toml_content = std::fs::read_to_string(&member_2_cargo_toml_path).unwrap();
889889
let modified_member_2_content =
890-
format!("{member_2_cargo_toml_content}\n[profile.release]\noverflow-checks = true\n",);
890+
format!("{member_2_cargo_toml_content}\n[profile.release]\noverflow-checks = true\n");
891891
std::fs::write(&member_2_cargo_toml_path, modified_member_2_content).unwrap();
892892

893893
sandbox

cmd/crates/stellar-ledger/src/emulator_test_support/http_transport.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl Exchange for Emulator {
7373
let resp: Response = HttpClient::new()
7474
.post(&self.url)
7575
.headers(headers)
76-
.timeout(Duration::from_secs(60))
76+
.timeout(Duration::from_mins(1))
7777
.json(&request)
7878
.send()
7979
.await

cmd/soroban-cli/src/commands/contract/arg_parsing.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,7 @@ fn parse_argument_with_validation(
629629
// unit variants — from_string in soroban-spec-tools handles both forms correctly.
630630
let is_union_udt = if let ScSpecTypeDef::Udt(udt) = expected_type {
631631
spec.find(&udt.name.to_utf8_string_lossy())
632-
.map(|entry| matches!(entry, ScSpecEntry::UdtUnionV0(_)))
633-
.unwrap_or(false)
632+
.is_ok_and(|entry| matches!(entry, ScSpecEntry::UdtUnionV0(_)))
634633
} else {
635634
false
636635
};

cmd/soroban-cli/src/commands/contract/init.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::borrow::Cow;
22
use std::{
3-
fs::{create_dir_all, metadata, write, Metadata},
3+
fs::{create_dir_all, metadata, write},
44
io,
55
path::{Path, PathBuf},
66
str,
@@ -158,10 +158,7 @@ impl Runner {
158158
}
159159

160160
fn file_exists(file_path: &Path) -> bool {
161-
metadata(file_path)
162-
.as_ref()
163-
.map(Metadata::is_file)
164-
.unwrap_or(false)
161+
metadata(file_path).is_ok_and(|m| m.is_file())
165162
}
166163

167164
fn create_dir_all(path: &Path) -> Result<(), Error> {

cmd/soroban-cli/src/commands/doctor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ async fn print_network(
9898
"Network"
9999
};
100100

101-
print.globeln(format!("{prefix} {name:?} ({})", network.rpc_url,));
101+
print.globeln(format!("{prefix} {name:?} ({})", network.rpc_url));
102102
print.blankln(format!("protocol {}", version_info.protocol_version));
103103
print.blankln(format!("rpc {}", version_info.version));
104104

cmd/soroban-cli/src/commands/snapshot/create.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -380,14 +380,12 @@ impl Cmd {
380380
ScVal::ContractInstance(ScContractInstance {
381381
executable: ContractExecutable::Wasm(hash),
382382
..
383-
}) => {
384-
if !current.wasm_hashes.contains(hash) {
385-
next.wasm_hashes.insert(hash.clone());
386-
print.infoln(format!(
387-
"Adding wasm {} to search",
388-
hex::encode(hash)
389-
));
390-
}
383+
}) if !current.wasm_hashes.contains(hash) => {
384+
next.wasm_hashes.insert(hash.clone());
385+
print.infoln(format!(
386+
"Adding wasm {} to search",
387+
hex::encode(hash)
388+
));
391389
}
392390
ScVal::ContractInstance(ScContractInstance {
393391
executable: ContractExecutable::StellarAsset,

cmd/soroban-cli/src/config/data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ impl std::fmt::Display for DatedAction {
131131
.map_or_else(|| "SUCCESS".to_string(), |_| "ERROR".to_string()),
132132
Action::Send { response } => response.status.clone(),
133133
};
134-
write!(f, "{id} {} {status} {datetime} {uri} ", a.type_str(),)
134+
write!(f, "{id} {} {status} {datetime} {uri} ", a.type_str())
135135
}
136136
}
137137

cmd/soroban-cli/src/log/cost.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ impl Debug for Cost<'_> {
77
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
88
// TODO: Should we output the footprint here?
99
writeln!(f, "==================== Cost ====================")?;
10-
writeln!(f, "CPU used: {}", self.0.instructions,)?;
11-
writeln!(f, "Bytes read: {}", self.0.disk_read_bytes,)?;
12-
writeln!(f, "Bytes written: {}", self.0.write_bytes,)?;
10+
writeln!(f, "CPU used: {}", self.0.instructions)?;
11+
writeln!(f, "Bytes read: {}", self.0.disk_read_bytes)?;
12+
writeln!(f, "Bytes written: {}", self.0.write_bytes)?;
1313
writeln!(f, "==============================================")?;
1414
Ok(())
1515
}

cmd/soroban-cli/src/log/event.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,15 @@ pub fn contract_with_spec(events: &[DiagnosticEvent], print: &Print, spec: Optio
101101
},
102102
in_successful_contract_call,
103103
..
104-
} => {
105-
if topics[0] == xdr::ScVal::Symbol(str_to_sc_symbol("log")) {
106-
let status = if in_successful_contract_call {
107-
"Success"
108-
} else {
109-
"Failure"
110-
};
104+
} if topics[0] == xdr::ScVal::Symbol(str_to_sc_symbol("log")) => {
105+
let status = if in_successful_contract_call {
106+
"Success"
107+
} else {
108+
"Failure"
109+
};
111110

112-
let data = serde_json::to_string(&data).unwrap();
113-
print.logln(format!("{contract_id} - {status} - Log: {data}"));
114-
}
111+
let data = serde_json::to_string(&data).unwrap();
112+
print.logln(format!("{contract_id} - {status} - Log: {data}"));
115113
}
116114

117115
_ => {}

0 commit comments

Comments
 (0)