Remove unused `ShieldStateCode::SentInClear`
VerificationState::to_shield_state_{strict,lax} return a type ShieldState, whose inner type ShieldStateCode currently includes a variant SentInClear for "unencrypted event". This is very misleading, because those functions never actually set that variant.
Rather, there is a separate method in matrix-sdk-ui, EventTimelineItem::get_shield, which uses the same type, but does set that variant where appropriate.
As a user of matrix-sdk-common, without the matrix-sdk-ui layer, this is dangerously misleading: it gives the impression that we are checking for unencrypted events, when in fact we are not.
The solution seems to be to use different types for the different levels of the stack.
While we're at it, we fix up some of the confusion of methods that return an Option of an enum type which itself has a None variant.
CodSpeed Performance Report
Merging #5959 will not alter performance
Comparing rav/clean_up_shield_state (66daf3f) with main (c3c367c)
Summary
✅ 50 untouched
Codecov Report
:x: Patch coverage is 17.39130% with 19 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 88.57%. Comparing base (c3c367c) to head (66daf3f).
:white_check_mark: All tests successful. No failed tests found.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| ...rates/matrix-sdk-ui/src/timeline/event_item/mod.rs | 17.39% | 19 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #5959 +/- ##
==========================================
- Coverage 88.58% 88.57% -0.02%
==========================================
Files 363 363
Lines 104268 104282 +14
Branches 104268 104282 +14
==========================================
- Hits 92371 92366 -5
- Misses 7536 7555 +19
Partials 4361 4361
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This will need complement-crypto updates, but maybe someone could give it a review for sanity before I invest time in that.
https://github.com/matrix-org/complement-crypto/pull/220 contains the fixes to complement-crypto
This will need a matching complement-crypto PR.