Repository navigation
Fix: Use div_ceil with proper blocks computation - #529
Conversation
|
@sylvestre I have made the changes, but the intention of the code change were not clear to me and were ambiguous in the issue description. Could you please review and let me know if some other changes are required. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #529 +/- ##
==========================================
+ Coverage 87.36% 87.49% +0.13%
==========================================
Files 31 31
Lines 6812 6815 +3
Branches 321 321
==========================================
+ Hits 5951 5963 +12
+ Misses 630 621 -9
Partials 231 231 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| let blocks = { | ||
| let blocks = meta()?.blocks(); | ||
| let len = blocks * STANDARD_BLOCK_SIZE; | ||
| let bs = if *large_blocks { 1024 } else { 512 }; |
There was a problem hiding this comment.
This is now wrong as it's dividing the result again by 2 in the next statement. I really meant to replace the whole thing with
FormatDirective::Blocks { large_blocks } => {
#[cfg(unix)]
let len = meta()?.blocks() * STANDARD_BLOCK_SIZE;
#[cfg(not(unix))]
let len = meta()?.len();
let bs = if *large_blocks { 1024 } else { 512 };
blocks.div_ceil(len, bs)
.to_string()
.into()
}There was a problem hiding this comment.
Thanks for the suggestion, I have made the changes. It's my first time contributing to open-source so i made a mistake. Could you please check it now, and let me know if its correct?
tavianator
left a comment
There was a problem hiding this comment.
This is still wrong, you're only changing the #[cfg(not(unix))] statement. You need to change the whole match guard
FormatDirective::Blocks { large_blocks } => {
...
}62af7c5 to
04a92a8
Compare
|
Please run cargo fmt on it |
|
Sir, I formatted the document. Sorry for the inconvenience caused. |
Fixes: #523