Skip to content

Commit

Permalink
Got clippy to pass.
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardgeek committed Feb 19, 2024
1 parent a83d353 commit 7b67696
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions oak_functions_service/benches/wasm_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ fn bench_invoke_lookup(c: &mut Criterion) {
let test_data = create_test_data(0, MAX_DATA_SIZE);
test_state
.lookup_data_manager
.extend_next_lookup_data(test_data.clone());
.extend_next_lookup_data(test_data.clone())
.unwrap();
test_state.lookup_data_manager.finish_next_lookup_data();

c.bench_function("lookup wasm", |b| {
Expand Down Expand Up @@ -121,14 +122,16 @@ fn bench_invoke_lookup_multi(c: &mut Criterion) {
let test_data = create_test_data(0, MAX_DATA_SIZE);
test_state_wasmi
.lookup_data_manager
.extend_next_lookup_data(test_data.clone());
.extend_next_lookup_data(test_data.clone())
.unwrap();
test_state_wasmi
.lookup_data_manager
.finish_next_lookup_data();

test_state_wasmtime
.lookup_data_manager
.extend_next_lookup_data(test_data.clone());
.extend_next_lookup_data(test_data.clone())
.unwrap();
test_state_wasmtime
.lookup_data_manager
.finish_next_lookup_data();
Expand Down
8 changes: 4 additions & 4 deletions oak_functions_service/src/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ use alloc::{
format,
string::{String, ToString},
sync::Arc,
vec::Vec,
};

use bytes::Bytes;
use hashbrown::HashMap;
use log::{info, Level};
use spinning_top::{RwSpinlock, Spinlock};

use crate::{logger::OakLogger, lookup_htbl::LookupHtbl};

// This is used to pass data to the lookup data module for tests.
pub type Data = Vec<(Bytes, Bytes)>;
pub type Data = HashMap<Bytes, Bytes>;

// Data maintains the invariant on lookup data to have [at most one
// value](https://github.com/project-oak/oak/tree/main/oak/oak_functions_service/README.md#invariant-at-most-one-value)
Expand Down Expand Up @@ -107,7 +107,7 @@ impl LookupDataManager {
}

/// Creates an instance of LookupData populated with the given entries.
pub fn for_test(data: Vec<(Bytes, Bytes)>, logger: Arc<dyn OakLogger>) -> Self {
pub fn for_test(data: Data, logger: Arc<dyn OakLogger>) -> Self {
let test_manager = Self::new_empty(logger);
test_manager.reserve(data.len() as u64).unwrap();
test_manager.extend_next_lookup_data(data).unwrap();
Expand Down Expand Up @@ -233,7 +233,7 @@ pub fn format_bytes(v: &[u8]) -> String {

#[cfg(test)]
mod tests {
use alloc::vec;
use alloc::{vec, vec::Vec};

use super::*;

Expand Down

0 comments on commit 7b67696

Please sign in to comment.