Use iter::zip in compiler/
This commit is contained in:
parent
3b1f5e3462
commit
72ebebe474
87 changed files with 213 additions and 204 deletions
|
@ -1,6 +1,7 @@
|
|||
// Code for creating styled buffers
|
||||
|
||||
use crate::snippet::{Style, StyledString};
|
||||
use std::iter;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct StyledBuffer {
|
||||
|
@ -20,11 +21,11 @@ impl StyledBuffer {
|
|||
let mut output: Vec<Vec<StyledString>> = vec![];
|
||||
let mut styled_vec: Vec<StyledString> = vec![];
|
||||
|
||||
for (row, row_style) in self.text.iter().zip(&self.styles) {
|
||||
for (row, row_style) in iter::zip(&self.text, &self.styles) {
|
||||
let mut current_style = Style::NoStyle;
|
||||
let mut current_text = String::new();
|
||||
|
||||
for (&c, &s) in row.iter().zip(row_style) {
|
||||
for (&c, &s) in iter::zip(row, row_style) {
|
||||
if s != current_style {
|
||||
if !current_text.is_empty() {
|
||||
styled_vec.push(StyledString { text: current_text, style: current_style });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue