Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed Jan 10, 2024
1 parent c3cc561 commit 1d48f14
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/subtags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ pub fn language_subtag(subtag: &str) -> Result<&str, ParserError> {
// https://unicode.org/reports/tr35/#unicode_language_subtag

// 'root' is a special case
if LANG_ROOT.eq(subtag) {
if matches!(subtag, LANG_ROOT) {
return Ok(LANG_EMPTY);
}

if !is_language_subtag(subtag.as_bytes()) {
return Err(ParserError::InvalidLanguage);
}

if LANG_UND == subtag {
if matches!(subtag, LANG_UND) {
Ok(LANG_EMPTY)
} else {
Ok(subtag)
Expand Down

0 comments on commit 1d48f14

Please sign in to comment.