Skip to content

Commit

Permalink
useless_vec
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge committed Jul 19, 2023
1 parent 82d1a66 commit c3fc19b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion net-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ mod tests {
let address = IpAddr::from([
525u16, 524u16, 523u16, 522u16, 521u16, 520u16, 519u16, 518u16,
]);
let mut data = vec![0u8; IP_ECHO_SERVER_RESPONSE_LENGTH];
let mut data = [0u8; IP_ECHO_SERVER_RESPONSE_LENGTH];
bincode::serialize_into(&mut data[HEADER_LENGTH..], &address).unwrap();
let response: Result<IpEchoServerResponse, _> =
bincode::deserialize(&data[HEADER_LENGTH..]);
Expand Down
12 changes: 6 additions & 6 deletions program-runtime/src/loaded_programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -857,8 +857,8 @@ mod tests {
let mut cache = LoadedPrograms::default();

let program1 = Pubkey::new_unique();
let program1_deployment_slots = vec![0, 10, 20];
let program1_usage_counters = vec![4, 5, 25];
let program1_deployment_slots = [0, 10, 20];
let program1_usage_counters = [4, 5, 25];
program1_deployment_slots
.iter()
.enumerate()
Expand Down Expand Up @@ -891,8 +891,8 @@ mod tests {
}

let program2 = Pubkey::new_unique();
let program2_deployment_slots = vec![5, 11];
let program2_usage_counters = vec![0, 2];
let program2_deployment_slots = [5, 11];
let program2_usage_counters = [0, 2];
program2_deployment_slots
.iter()
.enumerate()
Expand Down Expand Up @@ -924,8 +924,8 @@ mod tests {
}

let program3 = Pubkey::new_unique();
let program3_deployment_slots = vec![0, 5, 15];
let program3_usage_counters = vec![100, 3, 20];
let program3_deployment_slots = [0, 5, 15];
let program3_usage_counters = [100, 3, 20];
program3_deployment_slots
.iter()
.enumerate()
Expand Down
6 changes: 3 additions & 3 deletions sdk/program/src/entrypoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ mod test {
fn test_bump_allocator() {
// alloc the entire
{
let heap = vec![0u8; 128];
let heap = [0u8; 128];
let allocator = BumpAllocator {
start: heap.as_ptr() as *const _ as usize,
len: heap.len(),
Expand All @@ -398,7 +398,7 @@ mod test {
}
// check alignment
{
let heap = vec![0u8; 128];
let heap = [0u8; 128];
let allocator = BumpAllocator {
start: heap.as_ptr() as *const _ as usize,
len: heap.len(),
Expand All @@ -423,7 +423,7 @@ mod test {
}
// alloc entire block (minus the pos ptr)
{
let heap = vec![0u8; 128];
let heap = [0u8; 128];
let allocator = BumpAllocator {
start: heap.as_ptr() as *const _ as usize,
len: heap.len(),
Expand Down
4 changes: 2 additions & 2 deletions sdk/program/src/message/compiled_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ mod tests {

#[test]
fn test_try_drain_keys_found_in_lookup_table() {
let orig_keys = vec![
let orig_keys = [
Pubkey::new_unique(),
Pubkey::new_unique(),
Pubkey::new_unique(),
Expand Down Expand Up @@ -598,7 +598,7 @@ mod tests {

#[test]
fn test_try_drain_keys_found_in_lookup_table_with_empty_table() {
let original_keys = vec![
let original_keys = [
Pubkey::new_unique(),
Pubkey::new_unique(),
Pubkey::new_unique(),
Expand Down

0 comments on commit c3fc19b

Please sign in to comment.