Skip to content

refactor: Clean up the Room::compute_display_name() method#4306

Merged
poljar merged 1 commit intomainfrom
poljar/refactor-compute-display-name
Nov 21, 2024
Merged

refactor: Clean up the Room::compute_display_name() method#4306
poljar merged 1 commit intomainfrom
poljar/refactor-compute-display-name

Conversation

@poljar
Copy link
Copy Markdown
Contributor

@poljar poljar commented Nov 21, 2024

This method has grown organically into a bit of a beast. Let's try to make it a bit easier to understand in preparation for MSC4171 🫡.

@poljar poljar requested a review from a team as a code owner November 21, 2024 13:19
@poljar poljar requested review from jmartinesp and removed request for a team November 21, 2024 13:19
Copy link
Copy Markdown
Contributor

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks. Just a question about the weird drop issue you mentioned.

Comment on lines +593 to +596
// We can't directly compute the display name from the summary here because Rust
// thinks that the `inner` lock is still held even if we explicitly call `drop()`
// on it. So we introduced the DisplayNameOrSummary type and do the computation in
// two steps.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird, but OK. Is this some kind of bug in the compiler?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷 I have not investigated further, we had the same situation previously as well, but with some early returns.

I have somewhere seen that it's about thread local storage the lock uses, but no idea realistically.

@codecov
Copy link
Copy Markdown

codecov bot commented Nov 21, 2024

Codecov Report

Attention: Patch coverage is 95.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 85.08%. Comparing base (d2f255d) to head (4379050).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/matrix-sdk-base/src/rooms/normal.rs 95.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4306      +/-   ##
==========================================
- Coverage   85.11%   85.08%   -0.04%     
==========================================
  Files         274      274              
  Lines       30184    30191       +7     
==========================================
- Hits        25692    25688       -4     
- Misses       4492     4503      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@poljar poljar merged commit bc70f3c into main Nov 21, 2024
@poljar poljar deleted the poljar/refactor-compute-display-name branch November 21, 2024 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants