identifiers: Fix a typo in function name

This commit is contained in:
Jonas Platte 2021-06-01 12:46:44 +02:00
parent 97937d384c
commit 25dd8e8e2a
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
3 changed files with 8 additions and 4 deletions

View File

@ -1,5 +1,9 @@
# [unreleased] # [unreleased]
Breaking changes:
* Fix a typo in a public function name: `user_id::localpart_is_fully_{comforming => conforming}`
# 0.3.0 # 0.3.0
Breaking changes: Breaking changes:

View File

@ -5,7 +5,7 @@ use crate::{parse_id, Error};
pub fn validate(s: &str) -> Result<(NonZeroU8, bool), Error> { pub fn validate(s: &str) -> Result<(NonZeroU8, bool), Error> {
let colon_idx = parse_id(s, &['@'])?; let colon_idx = parse_id(s, &['@'])?;
let localpart = &s[1..colon_idx.get() as usize]; let localpart = &s[1..colon_idx.get() as usize];
let is_historical = localpart_is_fully_comforming(localpart)?; let is_historical = localpart_is_fully_conforming(localpart)?;
Ok((colon_idx, is_historical)) Ok((colon_idx, is_historical))
} }
@ -19,7 +19,7 @@ pub fn validate(s: &str) -> Result<(NonZeroU8, bool), Error> {
/// localparts. User IDs that don't even meet the historical user ID restrictions exist in the wild /// localparts. User IDs that don't even meet the historical user ID restrictions exist in the wild
/// due to Synapse allowing them over federation. This will likely be fixed in an upcoming room /// due to Synapse allowing them over federation. This will likely be fixed in an upcoming room
/// version; see <https://github.com/matrix-org/matrix-doc/pull/2828>. /// version; see <https://github.com/matrix-org/matrix-doc/pull/2828>.
pub fn localpart_is_fully_comforming(localpart: &str) -> Result<bool, Error> { pub fn localpart_is_fully_conforming(localpart: &str) -> Result<bool, Error> {
// See https://matrix.org/docs/spec/appendices#user-identifiers // See https://matrix.org/docs/spec/appendices#user-identifiers
let is_fully_conforming = localpart let is_fully_conforming = localpart
.bytes() .bytes()

View File

@ -65,7 +65,7 @@ impl UserId {
if id_str.starts_with('@') { if id_str.starts_with('@') {
try_from(id.into()) try_from(id.into())
} else { } else {
let is_fully_conforming = localpart_is_fully_comforming(id_str)?; let is_fully_conforming = localpart_is_fully_conforming(id_str)?;
Ok(Self { Ok(Self {
full_id: format!("@{}:{}", id_str, server_name).into(), full_id: format!("@{}:{}", id_str, server_name).into(),
@ -109,7 +109,7 @@ where
common_impls!(UserId, try_from, "a Matrix user ID"); common_impls!(UserId, try_from, "a Matrix user ID");
pub use ruma_identifiers_validation::user_id::localpart_is_fully_comforming; pub use ruma_identifiers_validation::user_id::localpart_is_fully_conforming;
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {