|
@@ -398,15 +398,15 @@ impl<'a> Parser<'a> {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
pub fn parse_scheme<'i>(&mut self, mut input: Input<'i>) -> Result<Input<'i>, ()> {
|
|
pub fn parse_scheme<'i>(&mut self, mut input: Input<'i>) -> Result<Input<'i>, ()> {
|
|
|
- if input.is_empty() || !input.starts_with(ascii_alpha) {
|
|
|
|
|
|
|
+ // starts_with will also fail for empty strings so we can skip that comparison for perf
|
|
|
|
|
+ if !input.starts_with(ascii_alpha) {
|
|
|
return Err(());
|
|
return Err(());
|
|
|
}
|
|
}
|
|
|
debug_assert!(self.serialization.is_empty());
|
|
debug_assert!(self.serialization.is_empty());
|
|
|
while let Some(c) = input.next() {
|
|
while let Some(c) = input.next() {
|
|
|
match c {
|
|
match c {
|
|
|
- 'a'..='z' | 'A'..='Z' | '0'..='9' | '+' | '-' | '.' => {
|
|
|
|
|
- self.serialization.push(c.to_ascii_lowercase())
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ 'a'..='z' | '0'..='9' | '+' | '-' | '.' => self.serialization.push(c),
|
|
|
|
|
+ 'A'..='Z' => self.serialization.push(c.to_ascii_lowercase()),
|
|
|
':' => return Ok(input),
|
|
':' => return Ok(input),
|
|
|
_ => {
|
|
_ => {
|
|
|
self.serialization.clear();
|
|
self.serialization.clear();
|