matrix-org / vodozemac

An implementation of Olm and Megolm in pure Rust.
Apache License 2.0
155 stars 29 forks source link

Apply const keyword to various methods #167

Closed MTRNord closed 1 month ago

MTRNord commented 1 month ago

This is based on the feedback given by the clippy missing_const_for_fn lint, which is still in nursery.

In a very non-scientific comparison, the olm-message-decoding afl fuzzer runs with ~0.5k to ~1k more executions per second on my PC.

I did not verify if any bindings rely on these to be not const. However, the test suite returned that everything is ok.

Signed-Off-By: MTRNord git@nordgedanken.dev

codecov-commenter commented 1 month ago

Codecov Report

Attention: Patch coverage is 95.31250% with 3 lines in your changes missing coverage. Please review.

Project coverage is 90.55%. Comparing base (4906baf) to head (c890027). Report is 1 commits behind head on main.

Files Patch % Lines
src/ecies/mod.rs 80.00% 1 Missing :warning:
src/olm/messages/message.rs 75.00% 1 Missing :warning:
src/olm/messages/pre_key.rs 83.33% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #167 +/- ## ======================================= Coverage 90.55% 90.55% ======================================= Files 34 34 Lines 1905 1906 +1 ======================================= + Hits 1725 1726 +1 Misses 180 180 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

MTRNord commented 1 month ago

(just commeting to ack that I have seen the clippy ci failing. Deal Ing with that when at my pc :))