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] #[test]
fn test_parser_iterator() { 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() .ansi_parse()
.collect(); .count();
assert_eq!(strings.len(), 6); assert_eq!(count, 6);
} }
#[test] #[test]
fn test_parser_iterator_failure() { 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() .ansi_parse()
.collect(); .count();
assert_eq!(strings.len(), 6); assert_eq!(count, 6);
} }
#[test] #[test]

View File

@@ -30,7 +30,7 @@ impl<'a> Iterator for AnsiParseIterator<'a> {
type Item = Output<'a>; type Item = Output<'a>;
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
if self.dat == "" { if self.dat.is_empty() {
return None; return None;
} }
@@ -40,7 +40,7 @@ impl<'a> Iterator for AnsiParseIterator<'a> {
let res = parse_escape(&self.dat[loc..]); let res = parse_escape(&self.dat[loc..]);
if let Ok(ret) = res { if let Ok(ret) = res {
self.dat = &ret.0; self.dat = ret.0;
Some(Output::Escape(ret.1)) Some(Output::Escape(ret.1))
}else{ }else{
let pos = self.dat[(loc+1)..].find('\u{1b}'); let pos = self.dat[(loc+1)..].find('\u{1b}');
@@ -64,7 +64,7 @@ impl<'a> Iterator for AnsiParseIterator<'a> {
let temp = &self.dat[..loc]; let temp = &self.dat[..loc];
self.dat = &self.dat[loc..]; self.dat = &self.dat[loc..];
Some(Output::TextBlock(&temp)) Some(Output::TextBlock(temp))
} }
}else{ }else{
let temp = self.dat; let temp = self.dat;