bpf_loader: fix clippy::blocks_in_conditions lint (#34643)

See https://github.com/solana-labs/solana/issues/34626
This commit is contained in:
Alessandro Decina 2024-01-04 11:58:10 +11:00 committed by GitHub
parent 0b49d82d3e
commit 917e242e7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 15 deletions

View File

@ -216,15 +216,7 @@ fn memcmp_non_contiguous(
n: u64,
memory_mapping: &MemoryMapping,
) -> Result<i32, Error> {
match iter_memory_pair_chunks(
AccessType::Load,
src_addr,
AccessType::Load,
dst_addr,
n,
memory_mapping,
false,
|s1_addr, s2_addr, chunk_len| {
let memcmp_chunk = |s1_addr, s2_addr, chunk_len| {
let res = unsafe {
let s1 = slice::from_raw_parts(s1_addr, chunk_len);
let s2 = slice::from_raw_parts(s2_addr, chunk_len);
@ -238,7 +230,16 @@ fn memcmp_non_contiguous(
return Err(MemcmpError::Diff(res).into());
}
Ok(0)
},
};
match iter_memory_pair_chunks(
AccessType::Load,
src_addr,
AccessType::Load,
dst_addr,
n,
memory_mapping,
false,
memcmp_chunk,
) {
Ok(res) => Ok(res),
Err(error) => match error.downcast_ref() {