From 1d48f145a557a627d5bc88c6f415a0f3fd1f6a20 Mon Sep 17 00:00:00 2001 From: kazuya kawaguchi Date: Wed, 10 Jan 2024 23:58:06 +0900 Subject: [PATCH] refactor --- src/subtags.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/subtags.rs b/src/subtags.rs index 9127c31..b07e6a5 100644 --- a/src/subtags.rs +++ b/src/subtags.rs @@ -11,7 +11,7 @@ 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); } @@ -19,7 +19,7 @@ pub fn language_subtag(subtag: &str) -> Result<&str, ParserError> { return Err(ParserError::InvalidLanguage); } - if LANG_UND == subtag { + if matches!(subtag, LANG_UND) { Ok(LANG_EMPTY) } else { Ok(subtag)