Skip to content

Commit 73c27d8

Browse files
committed
chore(sdk): Avoid cloning an OwnedUserId.
This patch uses `slice::from_ref` to create a `&[T]` from a `&T`. In our case, it saves the cost of one clone.
1 parent 54bd273 commit 73c27d8

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

crates/matrix-sdk/src/room/knock_requests.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
use std::slice;
16+
1517
use js_int::UInt;
1618
use ruma::{EventId, OwnedEventId, OwnedMxcUri, OwnedUserId, RoomId};
1719

@@ -56,7 +58,7 @@ impl KnockRequest {
5658
/// Marks the knock request as 'seen' so the client can ignore it in the
5759
/// future.
5860
pub async fn mark_as_seen(&self) -> Result<(), Error> {
59-
self.room.mark_knock_requests_as_seen(&[self.member_info.user_id.to_owned()]).await?;
61+
self.room.mark_knock_requests_as_seen(slice::from_ref(&self.member_info.user_id)).await?;
6062
Ok(())
6163
}
6264

0 commit comments

Comments
 (0)