Drop the unnecessary @Sendable from the composer attribute enumeration

`NSMutableAttributedString.enumerateAttribute(_:in:options:using:)` runs its
closure synchronously on the calling thread and its `using:` parameter isn't
`@Sendable`. The explicit `@Sendable` on the closure literals was therefore
unnecessary and was the only thing triggering the "capture of non-Sendable
NSMutableAttributedString" and "mutation of captured var in concurrently-
executing code" warnings. Removing it clears all six with no behaviour change.
This commit is contained in:
Stefan Ceriu
2026-06-23 11:55:01 +03:00
parent 95319d13b7
commit 122a0052ae
@@ -405,7 +405,7 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
repeat { // Don't enumerate and mutate at the same time, big no no
shouldMakeAnotherPass = false
attributedString.enumerateAttribute(.link, in: .init(location: 0, length: attributedString.length), options: []) { @Sendable value, range, stop in
attributedString.enumerateAttribute(.link, in: .init(location: 0, length: attributedString.length), options: []) { value, range, stop in
guard let value else { return }
shouldMakeAnotherPass = true
@@ -429,7 +429,7 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
repeat {
shouldMakeAnotherPass = false
attributedString.enumerateAttribute(.MatrixAllUsersMention, in: .init(location: 0, length: attributedString.length), options: []) { @Sendable value, range, stop in
attributedString.enumerateAttribute(.MatrixAllUsersMention, in: .init(location: 0, length: attributedString.length), options: []) { value, range, stop in
guard value != nil else { return }
shouldMakeAnotherPass = true