Skip to content

Commit aefb7d3

Browse files
committed
Clippy, fmt
1 parent 838f4a6 commit aefb7d3

File tree

3 files changed

+11
-30
lines changed

3 files changed

+11
-30
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ jobs:
3434
steps:
3535
- uses: actions/checkout@v3
3636
- uses: dtolnay/rust-toolchain@stable
37+
- uses: cargo-bins/cargo-binstall@main
3738

3839
- name: Install cargo fuzz
39-
uses: taiki-e/install-action@v2
40-
with:
41-
tool: cargo-fuzz
40+
run: cargo binstall cargo-fuzz --no-confirm --target x86_64-unknown-linux-gnu
4241

4342
- name: Smoke-test fuzz targets
4443
run: |

src/cache/key_pointers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl<KEY: Key, const KEYS: usize> KeyPointersCache<KEY> for CachedKeyPointers<KE
5454
}
5555

5656
fn notice_key_location(&mut self, key: &KEY, item_address: u32) {
57-
match self.key_index(&key) {
57+
match self.key_index(key) {
5858
Some(existing_index) => {
5959
self.key_pointers[existing_index] =
6060
Some((key.clone(), NonZeroU32::new(item_address).unwrap()));

src/map.rs

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,8 @@ pub async fn fetch_item<'d, K: Key, V: Value<'d>, S: NorFlash>(
131131
) -> Result<Option<V>, Error<S::Error>> {
132132
let result = run_with_auto_repair!(
133133
function = {
134-
fetch_item_with_location(
135-
flash,
136-
flash_range.clone(),
137-
cache,
138-
data_buffer,
139-
search_key,
140-
)
141-
.await
134+
fetch_item_with_location(flash, flash_range.clone(), cache, data_buffer, search_key)
135+
.await
142136
},
143137
repair = try_repair::<K, _>(flash, flash_range.clone(), cache, data_buffer).await?
144138
);
@@ -180,7 +174,7 @@ async fn fetch_item_with_location<'d, K: Key, S: NorFlash>(
180174
}
181175

182176
'cache: {
183-
if let Some(cached_location) = cache.key_location(&search_key) {
177+
if let Some(cached_location) = cache.key_location(search_key) {
184178
let page_index = calculate_page_index::<S>(flash_range.clone(), cached_location);
185179
let page_data_end_address =
186180
calculate_page_end_address::<S>(flash_range.clone(), page_index)
@@ -345,15 +339,8 @@ pub async fn store_item<'d, K: Key, V: Value<'d>, S: NorFlash>(
345339
item: &V,
346340
) -> Result<(), Error<S::Error>> {
347341
run_with_auto_repair!(
348-
function = store_item_inner(
349-
flash,
350-
flash_range.clone(),
351-
cache,
352-
data_buffer,
353-
key,
354-
item
355-
)
356-
.await,
342+
function =
343+
store_item_inner(flash, flash_range.clone(), cache, data_buffer, key, item).await,
357344
repair = try_repair::<K, _>(flash, flash_range.clone(), cache, data_buffer).await?
358345
)
359346
}
@@ -903,14 +890,9 @@ async fn migrate_items<K: Key, S: NorFlash>(
903890
cache.unmark_dirty();
904891

905892
// Search for the newest item with the key we found
906-
let Some((found_item, found_address, _)) = fetch_item_with_location::<K, S>(
907-
flash,
908-
flash_range.clone(),
909-
cache,
910-
data_buffer,
911-
&key,
912-
)
913-
.await?
893+
let Some((found_item, found_address, _)) =
894+
fetch_item_with_location::<K, S>(flash, flash_range.clone(), cache, data_buffer, &key)
895+
.await?
914896
else {
915897
// We couldn't even find our own item?
916898
return Err(Error::Corrupted {

0 commit comments

Comments
 (0)