Skip to content

Commit 463ba2e

Browse files
committed
Avoid unnecessary clones in the login_hint parser
1 parent a5c9468 commit 463ba2e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/data-model/src/oauth2/authorization_grant.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use rand::{
1717
distributions::{Alphanumeric, DistString},
1818
RngCore,
1919
};
20-
use ruma_common::{OwnedUserId, UserId};
20+
use ruma_common::UserId;
2121
use serde::Serialize;
2222
use ulid::Ulid;
2323
use url::Url;
@@ -142,8 +142,8 @@ impl AuthorizationGrantStage {
142142
}
143143
}
144144

145-
pub enum LoginHint {
146-
MXID(OwnedUserId),
145+
pub enum LoginHint<'a> {
146+
MXID(&'a UserId),
147147
None,
148148
}
149149

@@ -200,7 +200,7 @@ impl AuthorizationGrant {
200200
match prefix {
201201
"mxid" => {
202202
// Instead of erroring just return none
203-
let Ok(mxid) = UserId::parse(value) else {
203+
let Ok(mxid) = <&UserId>::try_from(value) else {
204204
return LoginHint::None;
205205
};
206206

0 commit comments

Comments
 (0)