refactor(html/parser): Remove unused code (#4613)

This commit is contained in:
Alexander Akait 2022-05-11 08:57:33 +03:00 committed by GitHub
parent 4b0df044bd
commit a378e1e041
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2202 additions and 2236 deletions

File diff suppressed because it is too large Load Diff

View File

@ -68,7 +68,6 @@ where
#[derive(Serialize, Deserialize, Debug)]
pub struct Entity {
codepoints: Vec<u32>,
characters: String,
}
@ -80,7 +79,6 @@ pub static HTML_ENTITIES: Lazy<AHashMap<String, Entity>> = Lazy::new(|| {
});
#[derive(Debug, Clone)]
#[allow(unused)]
pub enum State {
Data,
Rcdata,
@ -4985,8 +4983,6 @@ where
let mut entity_cur_pos: Option<BytePos> = None;
let mut entity_temporary_buffer = None;
// TODO fix me with surrogate pairs and in `NumericCharacterReferenceEnd` too
// and speedy
while let Some(c) = &self.consume_next_char() {
if let Some(ref mut temporary_buffer) = self.temporary_buffer {
temporary_buffer.push(*c);
@ -5000,9 +4996,10 @@ where
}
// We stop when:
//
// - not ascii alphanumeric
// - we consume more characters than the longest entity
if !c.is_ascii_alphanumeric() || temporary_buffer.len() > 33 {
if !c.is_ascii_alphanumeric() || temporary_buffer.len() > 32 {
break;
}
}