Fix clippy

This commit is contained in:
Maxim Zhiburt
2022-01-31 19:11:47 +03:00
parent 409724dc93
commit 9d45910632
2 changed files with 9 additions and 9 deletions

View File

@@ -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]

View File

@@ -30,7 +30,7 @@ impl<'a> Iterator for AnsiParseIterator<'a> {
type Item = Output<'a>;
fn next(&mut self) -> Option<Self::Item> {
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;