Skip to content

Commit 3e65fdc

Browse files
committed
Apply cargo clippy --fix --all
Signed-off-by: Eval EXEC <execvy@gmail.com>
1 parent c21f454 commit 3e65fdc

File tree

4 files changed

+31
-29
lines changed

4 files changed

+31
-29
lines changed

network/src/tests/peer_registry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(clippy::unchecked_duration_subtraction)]
1+
#![allow(clippy::unchecked_time_subtraction)]
22

33
use super::random_addr;
44
use crate::{

shared/src/shared_builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,8 @@ fn build_store(
530530
store_config: StoreConfig,
531531
ancient_path: Option<PathBuf>,
532532
) -> Result<ChainDB, Error> {
533-
let store = if store_config.freezer_enable && ancient_path.is_some() {
534-
let freezer = Freezer::open(ancient_path.expect("exist checked"))?;
533+
let store = if let (true, Some(ancient_path)) = (store_config.freezer_enable, ancient_path) {
534+
let freezer = Freezer::open(ancient_path)?;
535535
ChainDB::new_with_freezer(db, freezer, store_config)
536536
} else {
537537
ChainDB::new(db, store_config)

util/launcher/src/lib.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -146,34 +146,34 @@ impl Launcher {
146146
let store = shared.store();
147147
let stored_spec_hash = store.get_chain_spec_hash();
148148

149-
if stored_spec_hash.is_none() {
149+
if let Some(stored_hash) = stored_spec_hash {
150+
if stored_hash == self.args.chain_spec_hash {
151+
// stored == configured
152+
// do nothing
153+
} else if self.args.overwrite_chain_spec {
154+
// stored != configured with --overwrite-spec
155+
self.write_chain_spec_hash(store)?;
156+
info!(
157+
"Overwrite chain spec hash from {} to {}",
158+
stored_hash, self.args.overwrite_chain_spec,
159+
);
160+
} else if self.args.skip_chain_spec_check {
161+
// stored != configured with --skip-spec-check
162+
// do nothing
163+
} else {
164+
// stored != configured
165+
eprintln!(
166+
"chain_spec_hash mismatch: Config({}), storage({}). \
167+
If the two chains are compatible, pass command line argument --skip-spec-check; \
168+
otherwise, pass --overwrite-spec to enforce overriding the stored chain spec with the configured one.",
169+
self.args.chain_spec_hash, stored_hash
170+
);
171+
return Err(ExitCode::Config);
172+
}
173+
} else {
150174
// fresh yet
151175
self.write_chain_spec_hash(store)?;
152176
info!("Touch chain spec hash: {}", self.args.chain_spec_hash);
153-
} else if stored_spec_hash.as_ref() == Some(&self.args.chain_spec_hash) {
154-
// stored == configured
155-
// do nothing
156-
} else if self.args.overwrite_chain_spec {
157-
// stored != configured with --overwrite-spec
158-
self.write_chain_spec_hash(store)?;
159-
info!(
160-
"Overwrite chain spec hash from {} to {}",
161-
stored_spec_hash.expect("checked"),
162-
self.args.overwrite_chain_spec,
163-
);
164-
} else if self.args.skip_chain_spec_check {
165-
// stored != configured with --skip-spec-check
166-
// do nothing
167-
} else {
168-
// stored != configured
169-
eprintln!(
170-
"chain_spec_hash mismatch: Config({}), storage({}). \
171-
If the two chains are compatible, pass command line argument --skip-spec-check; \
172-
otherwise, pass --overwrite-spec to enforce overriding the stored chain spec with the configured one.",
173-
self.args.chain_spec_hash,
174-
stored_spec_hash.expect("checked")
175-
);
176-
return Err(ExitCode::Config);
177177
}
178178
Ok(())
179179
}

util/systemtime/src/test_faketime.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ mod tests_faketime {
55

66
#[test]
77
fn test_basic() {
8-
assert!(cfg!(feature = "enable_faketime"));
8+
const {
9+
assert!(cfg!(feature = "enable_faketime"));
10+
}
911

1012
let faketime_guard = faketime();
1113

0 commit comments

Comments
 (0)