mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 00:42:42 +00:00
Fix clippy errors on tests (#2160)
## Issue Addressed
There are some clippy error on tests.
## Proposed Changes
Enable clippy check on tests and fix the errors. 💪
This commit is contained in:
@@ -202,36 +202,24 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn test_strip_off() {
|
||||
let expected = "hello world".as_bytes().to_vec();
|
||||
let expected = b"hello world".to_vec();
|
||||
|
||||
assert_eq!(strip_off_newlines(b"hello world\n".to_vec()), expected);
|
||||
assert_eq!(
|
||||
strip_off_newlines("hello world\n".as_bytes().to_vec()),
|
||||
strip_off_newlines(b"hello world\n\n\n\n".to_vec()),
|
||||
expected
|
||||
);
|
||||
assert_eq!(strip_off_newlines(b"hello world\r".to_vec()), expected);
|
||||
assert_eq!(
|
||||
strip_off_newlines("hello world\n\n\n\n".as_bytes().to_vec()),
|
||||
strip_off_newlines(b"hello world\r\r\r\r\r".to_vec()),
|
||||
expected
|
||||
);
|
||||
assert_eq!(strip_off_newlines(b"hello world\r\n".to_vec()), expected);
|
||||
assert_eq!(
|
||||
strip_off_newlines("hello world\r".as_bytes().to_vec()),
|
||||
expected
|
||||
);
|
||||
assert_eq!(
|
||||
strip_off_newlines("hello world\r\r\r\r\r".as_bytes().to_vec()),
|
||||
expected
|
||||
);
|
||||
assert_eq!(
|
||||
strip_off_newlines("hello world\r\n".as_bytes().to_vec()),
|
||||
expected
|
||||
);
|
||||
assert_eq!(
|
||||
strip_off_newlines("hello world\r\n\r\n".as_bytes().to_vec()),
|
||||
expected
|
||||
);
|
||||
assert_eq!(
|
||||
strip_off_newlines("hello world".as_bytes().to_vec()),
|
||||
strip_off_newlines(b"hello world\r\n\r\n".to_vec()),
|
||||
expected
|
||||
);
|
||||
assert_eq!(strip_off_newlines(b"hello world".to_vec()), expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -247,8 +247,8 @@ mod tests {
|
||||
#[test]
|
||||
fn hard_coded_nets_work() {
|
||||
for net in HARDCODED_NETS {
|
||||
let config =
|
||||
Eth2NetworkConfig::from_hardcoded_net(net).expect(&format!("{:?}", net.name));
|
||||
let config = Eth2NetworkConfig::from_hardcoded_net(net)
|
||||
.unwrap_or_else(|_| panic!("{:?}", net.name));
|
||||
|
||||
if net.name == "mainnet" || net.name == "toledo" || net.name == "pyrmont" {
|
||||
// Ensure we can parse the YAML config to a chain spec.
|
||||
|
||||
@@ -110,7 +110,7 @@ mod test {
|
||||
|
||||
let _lockfile = File::create(&path).unwrap();
|
||||
|
||||
let lock = Lockfile::new(path.clone()).unwrap();
|
||||
let lock = Lockfile::new(path).unwrap();
|
||||
assert!(lock.file_existed());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user