diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-19 11:06:42 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-19 11:07:07 +0200 |
commit | ed42e65627f3283f0e002490fbcb652649fd3afc (patch) | |
tree | 8eba438f2b234714bcf00c5d4e9c9a836ff97baf /src/content/document.rs | |
parent | f98836b85ce71157adaa10c9d5ef5c0ee527e67a (diff) | |
download | markdown-rs-ed42e65627f3283f0e002490fbcb652649fd3afc.tar.gz markdown-rs-ed42e65627f3283f0e002490fbcb652649fd3afc.tar.bz2 markdown-rs-ed42e65627f3283f0e002490fbcb652649fd3afc.zip |
Replace use of `HashSet` with `vec`
Diffstat (limited to 'src/content/document.rs')
-rw-r--r-- | src/content/document.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/content/document.rs b/src/content/document.rs index 7656db7..d2c2426 100644 --- a/src/content/document.rs +++ b/src/content/document.rs @@ -26,7 +26,6 @@ use crate::util::{ skip, span::{from_exit_event, serialize}, }; -use std::collections::HashSet; /// Phases where we can exit containers. #[derive(Debug, PartialEq)] @@ -84,20 +83,24 @@ pub fn document(parse_state: &mut ParseState, point: Point, index: usize) -> Vec tokenizer.push(&parse_state.codes, Box::new(start), true); let mut index = 0; - let mut next_definitions: HashSet<String> = HashSet::new(); + let mut next_definitions = vec![]; while index < tokenizer.events.len() { let event = &tokenizer.events[index]; if event.event_type == EventType::Exit && event.token_type == Token::DefinitionLabelString { - next_definitions.insert(normalize_identifier( + let id = normalize_identifier( serialize( &parse_state.codes, &from_exit_event(&tokenizer.events, index), false, ) .as_str(), - )); + ); + + if !next_definitions.contains(&id) { + next_definitions.push(id); + } } index += 1; |