mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-26 20:16:31 +00:00
Fix clippy suggestions
This commit is contained in:
1 parent
0ae89168ad
commit
1fb5263c3b
2 files changed
+11
-37
No files matched your search
+2
-10
@@ -612,16 +612,8 @@ fn test_process_sign() {
|
|||||||
fn test_parse_as_hex() {
|
fn test_parse_as_hex() {
|
||||||
assert_eq!(try_parse_as_hex_number("73"), None);
|
assert_eq!(try_parse_as_hex_number("73"), None);
|
||||||
assert_eq!(try_parse_as_hex_number("0x1337"), Some(Ok(0x1337)));
|
assert_eq!(try_parse_as_hex_number("0x1337"), Some(Ok(0x1337)));
|
||||||
assert!(if let Some(Err(_)) = try_parse_as_hex_number("0xnope") {
|
assert!(matches!(try_parse_as_hex_number("0xnope"), Some(Err(_))));
|
||||||
true
|
assert!(matches!(try_parse_as_hex_number("0x-1"), Some(Err(_))));
|
||||||
} else {
|
|
||||||
false
|
|
||||||
});
|
|
||||||
assert!(if let Some(Err(_)) = try_parse_as_hex_number("0x-1") {
|
|
||||||
true
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
+9
-27
@@ -128,9 +128,8 @@ mod tests {
|
|||||||
SqueezeAction::Delete, // delete reoccurring line
|
SqueezeAction::Delete, // delete reoccurring line
|
||||||
];
|
];
|
||||||
|
|
||||||
let mut line = 0;
|
|
||||||
let mut idx = 1;
|
let mut idx = 1;
|
||||||
for z in v.chunks(LSIZE_USIZE) {
|
for (line, z) in v.chunks(LSIZE_USIZE).enumerate() {
|
||||||
for i in z {
|
for i in z {
|
||||||
s.process(*i, idx);
|
s.process(*i, idx);
|
||||||
idx += 1;
|
idx += 1;
|
||||||
@@ -138,7 +137,6 @@ mod tests {
|
|||||||
let action = s.action();
|
let action = s.action();
|
||||||
s.advance();
|
s.advance();
|
||||||
assert_eq!(action, exp[line]);
|
assert_eq!(action, exp[line]);
|
||||||
line += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,16 +156,14 @@ mod tests {
|
|||||||
SqueezeAction::Ignore, // last line only 12 bytes, print it
|
SqueezeAction::Ignore, // last line only 12 bytes, print it
|
||||||
];
|
];
|
||||||
|
|
||||||
let mut line = 0;
|
|
||||||
let mut idx = 1;
|
let mut idx = 1;
|
||||||
for z in v.chunks(LSIZE_USIZE) {
|
for (line, z) in v.chunks(LSIZE_USIZE).enumerate() {
|
||||||
for i in z {
|
for i in z {
|
||||||
s.process(*i, idx);
|
s.process(*i, idx);
|
||||||
idx += 1;
|
idx += 1;
|
||||||
}
|
}
|
||||||
assert_eq!(s.action(), exp[line]);
|
assert_eq!(s.action(), exp[line]);
|
||||||
s.advance();
|
s.advance();
|
||||||
line += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,9 +186,8 @@ mod tests {
|
|||||||
SqueezeAction::Ignore, // different
|
SqueezeAction::Ignore, // different
|
||||||
];
|
];
|
||||||
|
|
||||||
let mut line = 0;
|
|
||||||
let mut idx = 1;
|
let mut idx = 1;
|
||||||
for z in v.chunks(LSIZE_USIZE) {
|
for (line, z) in v.chunks(LSIZE_USIZE).enumerate() {
|
||||||
for i in z {
|
for i in z {
|
||||||
s.process(*i, idx);
|
s.process(*i, idx);
|
||||||
idx += 1;
|
idx += 1;
|
||||||
@@ -200,7 +195,6 @@ mod tests {
|
|||||||
let action = s.action();
|
let action = s.action();
|
||||||
assert_eq!(action, exp[line]);
|
assert_eq!(action, exp[line]);
|
||||||
s.advance();
|
s.advance();
|
||||||
line += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,9 +217,8 @@ mod tests {
|
|||||||
SqueezeAction::Ignore, // different lines, print again
|
SqueezeAction::Ignore, // different lines, print again
|
||||||
];
|
];
|
||||||
|
|
||||||
let mut line = 0;
|
|
||||||
let mut idx = 1;
|
let mut idx = 1;
|
||||||
for z in v.chunks(LSIZE_USIZE) {
|
for (line, z) in v.chunks(LSIZE_USIZE).enumerate() {
|
||||||
for i in z {
|
for i in z {
|
||||||
s.process(*i, idx);
|
s.process(*i, idx);
|
||||||
idx += 1;
|
idx += 1;
|
||||||
@@ -233,7 +226,6 @@ mod tests {
|
|||||||
let action = s.action();
|
let action = s.action();
|
||||||
s.advance();
|
s.advance();
|
||||||
assert_eq!(action, exp[line]);
|
assert_eq!(action, exp[line]);
|
||||||
line += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,9 +247,8 @@ mod tests {
|
|||||||
SqueezeAction::Ignore, // print squeeze symbol
|
SqueezeAction::Ignore, // print squeeze symbol
|
||||||
];
|
];
|
||||||
|
|
||||||
let mut line = 0;
|
|
||||||
let mut idx = 1;
|
let mut idx = 1;
|
||||||
for z in v.chunks(LSIZE_USIZE) {
|
for (line, z) in v.chunks(LSIZE_USIZE).enumerate() {
|
||||||
for i in z {
|
for i in z {
|
||||||
s.process(*i, idx);
|
s.process(*i, idx);
|
||||||
idx += 1;
|
idx += 1;
|
||||||
@@ -265,7 +256,6 @@ mod tests {
|
|||||||
let action = s.action();
|
let action = s.action();
|
||||||
s.advance();
|
s.advance();
|
||||||
assert_eq!(action, exp[line]);
|
assert_eq!(action, exp[line]);
|
||||||
line += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,9 +281,8 @@ mod tests {
|
|||||||
SqueezeAction::Ignore, // print squeeze symbol
|
SqueezeAction::Ignore, // print squeeze symbol
|
||||||
];
|
];
|
||||||
|
|
||||||
let mut line = 0;
|
|
||||||
let mut idx = 1;
|
let mut idx = 1;
|
||||||
for z in v.chunks(LSIZE_USIZE) {
|
for (line, z) in v.chunks(LSIZE_USIZE).enumerate() {
|
||||||
for i in z {
|
for i in z {
|
||||||
s.process(*i, idx);
|
s.process(*i, idx);
|
||||||
idx += 1;
|
idx += 1;
|
||||||
@@ -301,7 +290,6 @@ mod tests {
|
|||||||
let action = s.action();
|
let action = s.action();
|
||||||
s.advance();
|
s.advance();
|
||||||
assert_eq!(action, exp[line]);
|
assert_eq!(action, exp[line]);
|
||||||
line += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,9 +329,8 @@ mod tests {
|
|||||||
SqueezeAction::Ignore,
|
SqueezeAction::Ignore,
|
||||||
];
|
];
|
||||||
|
|
||||||
let mut line = 0;
|
|
||||||
let mut idx = 1;
|
let mut idx = 1;
|
||||||
for z in v.chunks(LSIZE_USIZE) {
|
for (line, z) in v.chunks(LSIZE_USIZE).enumerate() {
|
||||||
for i in z {
|
for i in z {
|
||||||
s.process(*i, idx);
|
s.process(*i, idx);
|
||||||
idx += 1;
|
idx += 1;
|
||||||
@@ -351,7 +338,6 @@ mod tests {
|
|||||||
let action = s.action();
|
let action = s.action();
|
||||||
s.advance();
|
s.advance();
|
||||||
assert_eq!(action, exp[line]);
|
assert_eq!(action, exp[line]);
|
||||||
line += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,16 +363,14 @@ mod tests {
|
|||||||
SqueezeAction::Print, // print '*' char
|
SqueezeAction::Print, // print '*' char
|
||||||
];
|
];
|
||||||
|
|
||||||
let mut line = 0;
|
|
||||||
let mut idx = 1;
|
let mut idx = 1;
|
||||||
for z in v.chunks(LSIZE_USIZE) {
|
for (line, z) in v.chunks(LSIZE_USIZE).enumerate() {
|
||||||
for i in z {
|
for i in z {
|
||||||
s.process(*i, idx);
|
s.process(*i, idx);
|
||||||
idx += 1;
|
idx += 1;
|
||||||
}
|
}
|
||||||
assert_eq!(s.action(), exp[line]);
|
assert_eq!(s.action(), exp[line]);
|
||||||
s.advance();
|
s.advance();
|
||||||
line += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,16 +394,14 @@ mod tests {
|
|||||||
SqueezeAction::Ignore, // print as is
|
SqueezeAction::Ignore, // print as is
|
||||||
];
|
];
|
||||||
|
|
||||||
let mut line = 0;
|
|
||||||
let mut idx = 1;
|
let mut idx = 1;
|
||||||
for z in v.chunks(LSIZE_USIZE) {
|
for (line, z) in v.chunks(LSIZE_USIZE).enumerate() {
|
||||||
for i in z {
|
for i in z {
|
||||||
s.process(*i, idx);
|
s.process(*i, idx);
|
||||||
idx += 1;
|
idx += 1;
|
||||||
}
|
}
|
||||||
assert_eq!(s.action(), exp[line]);
|
assert_eq!(s.action(), exp[line]);
|
||||||
s.advance();
|
s.advance();
|
||||||
line += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user