Skip to content

Commit

Permalink
Muzzle clippy type complexity warning.
Browse files Browse the repository at this point in the history
Despite clippy's suggestion, it is not currently possible to create type aliases
for traits and so everything within the 'Box<...>' cannot be type aliased.

This then leaves creating full blown traits, and either implementing
said traits by closure (somehow) or moving the closures into new structs
implementing said traits which seems a bit of a palaver.

Alternatively it is possible to define and use the type alias 'type ResultBox<T> = Result<Box<T>>'
which does seems rather pointless and not a great reduction in complexity but is enough to keep clippy happy.

In the end I simply went with squelching the clippy warning.
  • Loading branch information
svenski123 committed May 14, 2020
1 parent 6ab9222 commit 960dcb9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ledger/src/snapshot_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ where
Ok(ret)
}

#[allow(clippy::type_complexity)]
fn create_versioned_bank_snapshot_serializer<'a>(
snapshot_version: SnapshotVersion,
bank: &'a Bank,
Expand Down Expand Up @@ -451,6 +452,7 @@ fn create_versioned_bank_snapshot_serializer<'a>(
}
}

#[allow(clippy::type_complexity)]
fn create_versioned_bank_snapshot_deserializer<'a, P: AsRef<Path>>(
snapshot_version: &str,
account_paths: &'a [PathBuf],
Expand Down

0 comments on commit 960dcb9

Please sign in to comment.