clippy lints beta
This commit is contained in:
parent
1a38c27caa
commit
aa63ae6624
|
@ -227,6 +227,7 @@ fn update_checksum(checksum: &mut u32, item: [u8; 32]) {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unknown_lints, clippy::to_string_trait_impl)]
|
||||
impl ToString for LongPollId {
|
||||
/// Exact conversion from LongPollId to a string.
|
||||
fn to_string(&self) -> String {
|
||||
|
|
|
@ -636,13 +636,11 @@ impl Chain {
|
|||
.next()
|
||||
.expect("Zebra should never reach the max height in normal operation.");
|
||||
|
||||
if self.sprout_trees_by_height.get(&next_height).is_none() {
|
||||
// TODO: Use `try_insert` once it stabilises.
|
||||
self.sprout_trees_by_height.insert(
|
||||
next_height,
|
||||
highest_removed_tree.expect("There should be a cached removed tree."),
|
||||
);
|
||||
}
|
||||
self.sprout_trees_by_height
|
||||
.entry(next_height)
|
||||
.or_insert_with(|| {
|
||||
highest_removed_tree.expect("There should be a cached removed tree.")
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -839,13 +837,11 @@ impl Chain {
|
|||
.next()
|
||||
.expect("Zebra should never reach the max height in normal operation.");
|
||||
|
||||
if self.sapling_trees_by_height.get(&next_height).is_none() {
|
||||
// TODO: Use `try_insert` once it stabilises.
|
||||
self.sapling_trees_by_height.insert(
|
||||
next_height,
|
||||
highest_removed_tree.expect("There should be a cached removed tree."),
|
||||
);
|
||||
}
|
||||
self.sapling_trees_by_height
|
||||
.entry(next_height)
|
||||
.or_insert_with(|| {
|
||||
highest_removed_tree.expect("There should be a cached removed tree.")
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1048,13 +1044,11 @@ impl Chain {
|
|||
.next()
|
||||
.expect("Zebra should never reach the max height in normal operation.");
|
||||
|
||||
if self.orchard_trees_by_height.get(&next_height).is_none() {
|
||||
// TODO: Use `try_insert` once it stabilises.
|
||||
self.orchard_trees_by_height.insert(
|
||||
next_height,
|
||||
highest_removed_tree.expect("There should be a cached removed tree."),
|
||||
);
|
||||
}
|
||||
self.orchard_trees_by_height
|
||||
.entry(next_height)
|
||||
.or_insert_with(|| {
|
||||
highest_removed_tree.expect("There should be a cached removed tree.")
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -611,15 +611,15 @@ fn different_blocks_different_chains() -> Result<()> {
|
|||
|
||||
// blocks, heights, hashes
|
||||
chain1.blocks = chain2.blocks.clone();
|
||||
chain1.height_by_hash = chain2.height_by_hash.clone();
|
||||
chain1.tx_loc_by_hash = chain2.tx_loc_by_hash.clone();
|
||||
chain1.height_by_hash.clone_from(&chain2.height_by_hash);
|
||||
chain1.tx_loc_by_hash.clone_from(&chain2.tx_loc_by_hash);
|
||||
|
||||
// transparent UTXOs
|
||||
chain1.created_utxos = chain2.created_utxos.clone();
|
||||
chain1.spent_utxos = chain2.spent_utxos.clone();
|
||||
chain1.created_utxos.clone_from(&chain2.created_utxos);
|
||||
chain1.spent_utxos.clone_from(&chain2.spent_utxos);
|
||||
|
||||
// note commitment trees
|
||||
chain1.sprout_trees_by_anchor = chain2.sprout_trees_by_anchor.clone();
|
||||
chain1.sprout_trees_by_anchor.clone_from(&chain2.sprout_trees_by_anchor);
|
||||
chain1.sprout_trees_by_height = chain2.sprout_trees_by_height.clone();
|
||||
chain1.sapling_trees_by_height = chain2.sapling_trees_by_height.clone();
|
||||
chain1.orchard_trees_by_height = chain2.orchard_trees_by_height.clone();
|
||||
|
@ -640,9 +640,9 @@ fn different_blocks_different_chains() -> Result<()> {
|
|||
chain1.orchard_anchors_by_height = chain2.orchard_anchors_by_height.clone();
|
||||
|
||||
// nullifiers
|
||||
chain1.sprout_nullifiers = chain2.sprout_nullifiers.clone();
|
||||
chain1.sapling_nullifiers = chain2.sapling_nullifiers.clone();
|
||||
chain1.orchard_nullifiers = chain2.orchard_nullifiers.clone();
|
||||
chain1.sprout_nullifiers.clone_from(&chain2.sprout_nullifiers);
|
||||
chain1.sapling_nullifiers.clone_from(&chain2.sapling_nullifiers);
|
||||
chain1.orchard_nullifiers.clone_from(&chain2.orchard_nullifiers);
|
||||
|
||||
// proof of work
|
||||
chain1.partial_cumulative_work = chain2.partial_cumulative_work;
|
||||
|
|
|
@ -480,7 +480,7 @@ fn ephemeral(cache_dir_config: EphemeralConfig, cache_dir_check: EphemeralCheck)
|
|||
let ignored_cache_dir = run_dir.path().join("state");
|
||||
if cache_dir_config == EphemeralConfig::MisconfiguredCacheDir {
|
||||
// Write a configuration that sets both the cache_dir and ephemeral options
|
||||
config.state.cache_dir = ignored_cache_dir.clone();
|
||||
config.state.cache_dir.clone_from(&ignored_cache_dir);
|
||||
}
|
||||
if cache_dir_check == EphemeralCheck::ExistingDirectory {
|
||||
// We set the cache_dir config to a newly created empty temp directory,
|
||||
|
@ -2950,11 +2950,15 @@ fn scan_start_where_left() -> Result<()> {
|
|||
config.shielded_scan.sapling_keys_to_scan = keys;
|
||||
|
||||
// Add the cache dir to shielded scan, make it the same as the zebrad cache state.
|
||||
config.shielded_scan.db_config_mut().cache_dir = cache_dir.clone();
|
||||
config
|
||||
.shielded_scan
|
||||
.db_config_mut()
|
||||
.cache_dir
|
||||
.clone_from(&cache_dir);
|
||||
config.shielded_scan.db_config_mut().ephemeral = false;
|
||||
|
||||
// Add the cache dir to state.
|
||||
config.state.cache_dir = cache_dir.clone();
|
||||
config.state.cache_dir.clone_from(&cache_dir);
|
||||
config.state.ephemeral = false;
|
||||
|
||||
// Remove the scan directory before starting.
|
||||
|
|
|
@ -69,7 +69,10 @@ pub(crate) async fn run() -> Result<()> {
|
|||
.expect("already checked that there is a cached state path");
|
||||
|
||||
let mut scan_config = zebra_scan::Config::default();
|
||||
scan_config.db_config_mut().cache_dir = zebrad_state_path.clone();
|
||||
scan_config
|
||||
.db_config_mut()
|
||||
.cache_dir
|
||||
.clone_from(&zebrad_state_path);
|
||||
|
||||
// Logs the network as zebrad would as part of the metadata when starting up.
|
||||
// This is currently needed for the 'Check startup logs' step in CI to pass.
|
||||
|
|
Loading…
Reference in New Issue