Remove unnecessary explicit lifetimes
This commit is contained in:
parent
88fcdb6f9b
commit
2a0414cd60
@ -156,7 +156,7 @@ impl<'de> Deserialize<'de> for EventId {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TryFrom<&'a str> for EventId {
|
||||
impl TryFrom<&str> for EventId {
|
||||
type Error = Error;
|
||||
|
||||
/// Attempts to create a new Matrix event ID from a string representation.
|
||||
@ -164,7 +164,7 @@ impl<'a> TryFrom<&'a str> for EventId {
|
||||
/// If using the original event format as used by Matrix room versions 1 and 2, the string must
|
||||
/// include the leading $ sigil, the localpart, a literal colon, and a valid homeserver
|
||||
/// hostname.
|
||||
fn try_from(event_id: &'a str) -> Result<Self, Self::Error> {
|
||||
fn try_from(event_id: &str) -> Result<Self, Self::Error> {
|
||||
if event_id.contains(':') {
|
||||
let (localpart, host, port) = parse_id('$', event_id)?;
|
||||
|
||||
|
@ -81,14 +81,14 @@ impl<'de> Deserialize<'de> for RoomAliasId {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TryFrom<&'a str> for RoomAliasId {
|
||||
impl TryFrom<&str> for RoomAliasId {
|
||||
type Error = Error;
|
||||
|
||||
/// Attempts to create a new Matrix room alias ID from a string representation.
|
||||
///
|
||||
/// The string must include the leading # sigil, the alias, a literal colon, and a valid
|
||||
/// server name.
|
||||
fn try_from(room_id: &'a str) -> Result<Self, Error> {
|
||||
fn try_from(room_id: &str) -> Result<Self, Error> {
|
||||
let (alias, host, port) = parse_id('#', room_id)?;
|
||||
|
||||
Ok(Self {
|
||||
|
@ -96,14 +96,14 @@ impl<'de> Deserialize<'de> for RoomId {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TryFrom<&'a str> for RoomId {
|
||||
impl TryFrom<&str> for RoomId {
|
||||
type Error = Error;
|
||||
|
||||
/// Attempts to create a new Matrix room ID from a string representation.
|
||||
///
|
||||
/// The string must include the leading ! sigil, the localpart, a literal colon, and a valid
|
||||
/// server name.
|
||||
fn try_from(room_id: &'a str) -> Result<Self, Error> {
|
||||
fn try_from(room_id: &str) -> Result<Self, Error> {
|
||||
let (localpart, host, port) = parse_id('!', room_id)?;
|
||||
|
||||
Ok(Self {
|
||||
|
@ -89,7 +89,7 @@ impl<'de> Deserialize<'de> for RoomIdOrAliasId {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TryFrom<&'a str> for RoomIdOrAliasId {
|
||||
impl TryFrom<&str> for RoomIdOrAliasId {
|
||||
type Error = Error;
|
||||
|
||||
/// Attempts to create a new Matrix room ID or a room alias ID from a string representation.
|
||||
@ -97,7 +97,7 @@ impl<'a> TryFrom<&'a str> for RoomIdOrAliasId {
|
||||
/// The string must either include the leading ! sigil, the localpart, a literal colon, and a
|
||||
/// valid homeserver host or include the leading # sigil, the alias, a literal colon, and a
|
||||
/// valid homeserver host.
|
||||
fn try_from(room_id_or_alias_id: &'a str) -> Result<Self, Error> {
|
||||
fn try_from(room_id_or_alias_id: &str) -> Result<Self, Error> {
|
||||
validate_id(room_id_or_alias_id)?;
|
||||
|
||||
let mut chars = room_id_or_alias_id.chars();
|
||||
|
@ -155,11 +155,11 @@ impl<'de> Deserialize<'de> for RoomVersionId {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TryFrom<&'a str> for RoomVersionId {
|
||||
impl TryFrom<&str> for RoomVersionId {
|
||||
type Error = Error;
|
||||
|
||||
/// Attempts to create a new Matrix room version ID from a string representation.
|
||||
fn try_from(room_version_id: &'a str) -> Result<Self, Error> {
|
||||
fn try_from(room_version_id: &str) -> Result<Self, Error> {
|
||||
let version = match room_version_id {
|
||||
"1" => Self(InnerRoomVersionId::Version1),
|
||||
"2" => Self(InnerRoomVersionId::Version2),
|
||||
|
@ -114,14 +114,14 @@ impl<'de> Deserialize<'de> for UserId {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TryFrom<&'a str> for UserId {
|
||||
impl TryFrom<&str> for UserId {
|
||||
type Error = Error;
|
||||
|
||||
/// Attempts to create a new Matrix user ID from a string representation.
|
||||
///
|
||||
/// The string must include the leading @ sigil, the localpart, a literal colon, and a valid
|
||||
/// server name.
|
||||
fn try_from(user_id: &'a str) -> Result<Self, Error> {
|
||||
fn try_from(user_id: &str) -> Result<Self, Error> {
|
||||
let (localpart, host, port) = parse_id('@', user_id)?;
|
||||
let downcased_localpart = localpart.to_lowercase();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user