Fixes some clippy warnings

pull/10/head
Tpt 6 years ago
parent 9f6f3ca6d7
commit 649fdce93f
  1. 23
      lib/src/model/language_tag.rs

@ -163,6 +163,17 @@ impl LanguageTag {
///
/// If the language tag is not "well-formed" a [`ParseError`] variant will be returned.
pub fn parse(input: &str) -> Result<Self, ParseError> {
#[derive(PartialEq, Eq)]
enum State {
Start,
AfterLanguage,
AfterExtLang,
AfterScript,
AfterRegion,
InExtension { expected: bool },
InPrivateUse { expected: bool },
}
//grandfathered tags
if let Some(tag) = GRANDFATHERED.iter().find(|x| x.eq_ignore_ascii_case(input)) {
return Ok(Self {
@ -195,16 +206,6 @@ impl LanguageTag {
});
}
#[derive(PartialEq, Eq)]
enum State {
Start,
AfterLanguage,
AfterExtLang,
AfterScript,
AfterRegion,
InExtension { expected: bool },
InPrivateUse { expected: bool },
}
let mut serialization = String::with_capacity(input.len());
let mut state = State::Start;
@ -430,7 +431,7 @@ impl FromStr for LanguageTag {
}
}
const GRANDFATHERED: [&'static str; 26] = [
const GRANDFATHERED: [&str; 26] = [
"en-GB-oed",
"i-ami",
"i-bnn",

Loading…
Cancel
Save