Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Philipp Krüger <philipp.krueger1@gmail.com>
Signed-off-by: Steven Vandevelde <steven.vandevelde@hey.com>
  • Loading branch information
icidasset and matheus23 authored Dec 20, 2023
1 parent a9bdb85 commit 78f74c5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions wnfs/src/private/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -979,8 +979,8 @@ impl PrivateForestContent {
let block_content_size = MAX_BLOCK_CONTENT_SIZE as u64;
let mut chunk_size_upper_bound = self.get_size_upper_bound() - byte_offset as usize;

if len_limit.is_some() {
chunk_size_upper_bound = chunk_size_upper_bound.min(len_limit.unwrap());
if let Some(len_limit) = len_limit {
chunk_size_upper_bound = chunk_size_upper_bound.min(len_limit);
}

if chunk_size_upper_bound == 0 {
Expand All @@ -1001,8 +1001,8 @@ impl PrivateForestContent {
} else {
0
};
let to = if Some(index) == last_block {
(byte_offset + len_limit.unwrap() as u64 - index * block_content_size)
let to = if let Some(len_limit) = len_limit && Some(index) == last_block {

Check failure on line 1004 in wnfs/src/private/file.rs

View workflow job for this annotation

GitHub Actions / wasm-js-tests (stable)

`let` expressions in this position are unstable

Check failure on line 1004 in wnfs/src/private/file.rs

View workflow job for this annotation

GitHub Actions / wasm-js-tests (nightly)

`let` expressions in this position are unstable

Check failure on line 1004 in wnfs/src/private/file.rs

View workflow job for this annotation

GitHub Actions / rust-checks (stable)

`let` expressions in this position are unstable
(byte_offset + len_limit as u64 - index * block_content_size)
.min(chunk.len() as u64)
} else {
chunk.len() as u64
Expand Down

0 comments on commit 78f74c5

Please sign in to comment.