diff options
| author | Philipp A | 2023-12-28 15:08:37 +0100 |
|---|---|---|
| committer | GitHub | 2023-12-28 15:08:37 +0100 |
| commit | c0441bff302e724bb8f98420459a2c672e2286c6 (patch) | |
| tree | 5b09a73e2dbf83ea359277863e005f89b56617fe /parser/src/conversion.rs | |
| parent | f06fe35f7537feb28c7c38b33c1bca9ff4ebd2a9 (diff) | |
| download | rust-rst-c0441bff302e724bb8f98420459a2c672e2286c6.tar.bz2 | |
Add CI (#36)
Diffstat (limited to 'parser/src/conversion.rs')
| -rw-r--r-- | parser/src/conversion.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/parser/src/conversion.rs b/parser/src/conversion.rs index de5f091..5e855ef 100644 --- a/parser/src/conversion.rs +++ b/parser/src/conversion.rs @@ -40,7 +40,7 @@ fn get_level<'tl>(toplevel: &'tl mut Vec<c::StructuralSubElement>, section_idxs: pub fn convert_document(pairs: Pairs<Rule>) -> Result<e::Document, Error> { use self::block::TitleOrSsubel::*; - + let mut toplevel: Vec<c::StructuralSubElement> = vec![]; // The kinds of section titles encountered. // `section_idx[x]` has the kind `kinds[x]`, but `kinds` can be longer @@ -49,7 +49,7 @@ pub fn convert_document(pairs: Pairs<Rule>) -> Result<e::Document, Error> { // `None`s indicate skipped section levels: // toplevel[section_idxs.flatten()[0]].children[section_idxs.flatten()[1]]... let mut section_idxs: Vec<Option<usize>> = vec![]; - + for pair in pairs { if let Some(ssubel) = block::convert_ssubel(pair)? { match ssubel { Title(title, kind) => { @@ -83,7 +83,7 @@ pub fn convert_document(pairs: Pairs<Rule>) -> Result<e::Document, Error> { pub fn whitespace_normalize_name(name: &str) -> String { // Python's string.split() defines whitespace differently than Rust does. let split_iter = name.split( - |ch: char| ch.is_whitespace() || (ch >= '\x1C' && ch <= '\x1F') + |ch: char| ch.is_whitespace() || ('\x1C'..='\x1F').contains(&ch) ).filter(|split| !split.is_empty()); let mut ret = String::new(); for split in split_iter { |
