turbofish-org / merk

High-performance Merkle key/value store
Apache License 2.0
226 stars 36 forks source link

Clippy fixes #53

Closed cwlittle closed 3 years ago

cwlittle commented 3 years ago

@mappum I'll need a bit of help getting the safety sections written out for detach and detach_expect in src/tree/walk/mod.rs. I tried to remove the unsafe in the function definition to see the location of the unsafe lines in detach to get a bit more context, but it looks like this is unsafe for some reason beyond that. It's still a bit arcane to me.

cwlittle commented 3 years ago

Although, it looks like the result that triggers a clippy failure is only an error. In our case, it was the drop rather than ManuallyDrop::drop that wasn't dropping the inner value. Clippy is passing with just warnings. We could leave these safety blocks until we revisit documentation. In any case, keeping clippy clean in merk will be much easier now that we have less of a wall to deal with.

mappum commented 3 years ago

Also removed the unsafe markers from those 2 methods, since it was overkill anyway. It was just there to mark that modifying the tree could result in a weird state if you forget to finalize it (e.g. recomputing hashes), but the tree API is a low-level internal API so I don't think we have to make that so explicit.

codecov-commenter commented 3 years ago

Codecov Report

Merging #53 (9672627) into develop (6fa0e16) will increase coverage by 0.05%. The diff coverage is 90.47%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop      #53      +/-   ##
===========================================
+ Coverage    91.47%   91.53%   +0.05%     
===========================================
  Files           24       24              
  Lines         3157     3141      -16     
===========================================
- Hits          2888     2875      -13     
+ Misses         269      266       -3     
Impacted Files Coverage Δ
src/test_utils/mod.rs 59.75% <50.00%> (ø)
src/merk/mod.rs 89.09% <75.00%> (+0.27%) :arrow_up:
src/proofs/query/mod.rs 98.62% <85.71%> (+0.26%) :arrow_up:
src/merk/chunks.rs 98.58% <100.00%> (ø)
src/merk/restore.rs 92.85% <100.00%> (ø)
src/proofs/chunk.rs 96.29% <100.00%> (-0.04%) :arrow_down:
src/proofs/encoding.rs 98.38% <100.00%> (-0.03%) :arrow_down:
src/proofs/query/map.rs 97.93% <100.00%> (ø)
src/proofs/tree.rs 94.80% <100.00%> (ø)
src/test_utils/crash_merk.rs 100.00% <100.00%> (ø)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6fa0e16...9672627. Read the comment docs.