1.57.0 lints (#2850)

## Issue Addressed

New rust lints

## Proposed Changes

- Boxing some enum variants
- removing some unused fields (is the validator lockfile unused? seemed so to me)

## Additional Info

- some error fields were marked as dead code but are logged out in areas
- left some dead fields in our ef test code because I assume they are useful for debugging?

Co-authored-by: realbigsean <seananderson33@gmail.com>
This commit is contained in:
realbigsean
2021-12-03 04:44:30 +00:00
parent f3c237cfa0
commit a80ccc3a33
22 changed files with 64 additions and 56 deletions

View File

@@ -777,7 +777,7 @@ pub struct SseLateHead {
#[derive(PartialEq, Debug, Serialize, Clone)]
#[serde(bound = "T: EthSpec", untagged)]
pub enum EventKind<T: EthSpec> {
Attestation(Attestation<T>),
Attestation(Box<Attestation<T>>),
Block(SseBlock),
FinalizedCheckpoint(SseFinalizedCheckpoint),
Head(SseHead),

View File

@@ -11,7 +11,7 @@ use std::path::{Path, PathBuf};
/// outage) caused the lockfile not to be deleted.
#[derive(Debug)]
pub struct Lockfile {
file: File,
_file: File,
path: PathBuf,
file_existed: bool,
}
@@ -43,7 +43,7 @@ impl Lockfile {
_ => LockfileError::IoError(path.clone(), e),
})?;
Ok(Self {
file,
_file: file,
path,
file_existed,
})

View File

@@ -99,7 +99,7 @@ impl<'a> AlignedRecordDecorator<'a> {
impl<'a> Write for AlignedRecordDecorator<'a> {
fn write(&mut self, buf: &[u8]) -> Result<usize> {
if buf.iter().any(|c| is_ascii_control(c)) {
if buf.iter().any(u8::is_ascii_control) {
let filtered = buf
.iter()
.cloned()

View File

@@ -128,7 +128,7 @@ impl MonitoringHttpClient {
Error::BeaconMetricsFailed("Beacon metrics require db path".to_string())
})?;
let freezer_db_path = self.db_path.as_ref().ok_or_else(|| {
let freezer_db_path = self.freezer_db_path.as_ref().ok_or_else(|| {
Error::BeaconMetricsFailed("Beacon metrics require freezer db path".to_string())
})?;
let metrics =

View File

@@ -63,7 +63,7 @@ pub struct Eth1DepositData {
pub struct ValidatorDir {
dir: PathBuf,
#[derivative(PartialEq = "ignore")]
lockfile: Lockfile,
_lockfile: Lockfile,
}
impl ValidatorDir {
@@ -85,7 +85,10 @@ impl ValidatorDir {
let lockfile_path = dir.join(format!("{}.lock", VOTING_KEYSTORE_FILE));
let lockfile = Lockfile::new(lockfile_path).map_err(Error::LockfileError)?;
Ok(Self { dir, lockfile })
Ok(Self {
dir,
_lockfile: lockfile,
})
}
/// Returns the `dir` provided to `Self::open`.