diff --git a/src/parsers/tests.rs b/src/parsers/tests.rs index a625d50..e55be5d 100644 --- a/src/parsers/tests.rs +++ b/src/parsers/tests.rs @@ -109,20 +109,20 @@ test_parser!(set_single_shift3, "\u{1b}O"); #[test] fn test_parser_iterator() { - let strings: Vec<_> = "\x1b[=25l\x1b[=7l\x1b[0m\x1b[36m\x1b[1m-`" + let count = "\x1b[=25l\x1b[=7l\x1b[0m\x1b[36m\x1b[1m-`" .ansi_parse() - .collect(); + .count(); - assert_eq!(strings.len(), 6); + assert_eq!(count, 6); } #[test] fn test_parser_iterator_failure() { - let strings: Vec<_> = "\x1b[=25l\x1b[=7l\x1b[0m\x1b[36;1;15;2m\x1b[1m-`" + let count = "\x1b[=25l\x1b[=7l\x1b[0m\x1b[36;1;15;2m\x1b[1m-`" .ansi_parse() - .collect(); + .count(); - assert_eq!(strings.len(), 6); + assert_eq!(count, 6); } #[test] diff --git a/src/traits.rs b/src/traits.rs index 9d5b35a..4eb9358 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -30,7 +30,7 @@ impl<'a> Iterator for AnsiParseIterator<'a> { type Item = Output<'a>; fn next(&mut self) -> Option { - if self.dat == "" { + if self.dat.is_empty() { return None; } @@ -40,7 +40,7 @@ impl<'a> Iterator for AnsiParseIterator<'a> { let res = parse_escape(&self.dat[loc..]); if let Ok(ret) = res { - self.dat = &ret.0; + self.dat = ret.0; Some(Output::Escape(ret.1)) }else{ let pos = self.dat[(loc+1)..].find('\u{1b}'); @@ -64,7 +64,7 @@ impl<'a> Iterator for AnsiParseIterator<'a> { let temp = &self.dat[..loc]; self.dat = &self.dat[loc..]; - Some(Output::TextBlock(&temp)) + Some(Output::TextBlock(temp)) } }else{ let temp = self.dat;