on master help sign in
Use filter_map rather than flat_map
e22dbf1Blaž Hrastnik
helix-core/src/syntax.rs+1−1
@@ -723,7 +723,7 @@ impl Syntax {
723 let mut layers = self
723 let mut layers = self
724 .layers
724 .layers
725 .iter()
725 .iter()
726− .flat_map(|(_, layer)| {
726+ .filter_map(|(_, layer)| {
727 // Reuse a cursor from the pool if available.
727 // Reuse a cursor from the pool if available.
728 let mut cursor = PARSER.with(|ts_parser| {
728 let mut cursor = PARSER.with(|ts_parser| {
729 let highlighter = &mut ts_parser.borrow_mut();
729 let highlighter = &mut ts_parser.borrow_mut();