Skip to content

Commit 3770e2a

Browse files
authored
Merge pull request #5916 from obycode/chore/clippy-instant
chore: fix clippy warning about `Instant`
2 parents 106719d + eb3a141 commit 3770e2a

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

stackslib/src/cost_estimates/tests/cost_estimators.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::env;
22
use std::path::PathBuf;
3+
use std::time::Instant;
34

45
use clarity::vm::costs::ExecutionCost;
56
use clarity::vm::types::{PrincipalData, StandardPrincipalData};
@@ -11,7 +12,6 @@ use stacks_common::types::chainstate::{
1112
};
1213
use stacks_common::util::hash::{to_hex, Hash160, Sha512Trunc256Sum};
1314
use stacks_common::util::vrf::VRFProof;
14-
use time::Instant;
1515

1616
use crate::chainstate::burn::ConsensusHash;
1717
use crate::chainstate::stacks::db::{StacksEpochReceipt, StacksHeaderInfo};

stackslib/src/cost_estimates/tests/fee_scalar.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::env;
22
use std::path::PathBuf;
3+
use std::time::Instant;
34

45
use clarity::vm::costs::ExecutionCost;
56
use clarity::vm::types::{PrincipalData, StandardPrincipalData};
@@ -11,7 +12,6 @@ use stacks_common::types::chainstate::{
1112
};
1213
use stacks_common::util::hash::{to_hex, Hash160, Sha512Trunc256Sum};
1314
use stacks_common::util::vrf::VRFProof;
14-
use time::Instant;
1515

1616
use crate::chainstate::burn::ConsensusHash;
1717
use crate::chainstate::stacks::db::{StacksEpochReceipt, StacksHeaderInfo};

stackslib/src/main.rs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use std::fs::File;
3737
use std::io::prelude::*;
3838
use std::io::BufReader;
3939
use std::net::{SocketAddr, TcpStream, ToSocketAddrs};
40-
use std::time::Duration;
40+
use std::time::{Duration, Instant};
4141
use std::{env, fs, io, process, thread};
4242

4343
use blockstack_lib::burnchains::bitcoin::{spv, BitcoinNetworkType};
@@ -605,7 +605,7 @@ Given a <working-dir>, obtain a 2100 header hash block inventory (with an empty
605605
let chain_tip = SortitionDB::get_canonical_burn_chain_tip(sort_db.conn())
606606
.expect("Failed to get sortition chain tip");
607607

608-
let start = time::Instant::now();
608+
let start = Instant::now();
609609

610610
let header_hashes = {
611611
let ic = sort_db.index_conn();
@@ -614,14 +614,11 @@ Given a <working-dir>, obtain a 2100 header hash block inventory (with an empty
614614
.unwrap()
615615
};
616616

617-
println!(
618-
"Fetched header hashes in {}",
619-
start.elapsed().as_seconds_f32()
620-
);
621-
let start = time::Instant::now();
617+
println!("Fetched header hashes in {}", start.elapsed().as_secs_f32());
618+
let start = Instant::now();
622619

623620
let block_inv = chain_state.get_blocks_inventory(&header_hashes).unwrap();
624-
println!("Fetched block inv in {}", start.elapsed().as_seconds_f32());
621+
println!("Fetched block inv in {}", start.elapsed().as_secs_f32());
625622
println!("{:?}", &block_inv);
626623

627624
println!("Done!");
@@ -652,7 +649,7 @@ check if the associated microblocks can be downloaded
652649
let chain_tip = SortitionDB::get_canonical_burn_chain_tip(sort_db.conn())
653650
.expect("Failed to get sortition chain tip");
654651

655-
let start = time::Instant::now();
652+
let start = Instant::now();
656653
let local_peer = LocalPeer::new(
657654
0,
658655
0,
@@ -671,12 +668,9 @@ check if the associated microblocks can be downloaded
671668
.unwrap()
672669
};
673670

674-
println!(
675-
"Fetched header hashes in {}",
676-
start.elapsed().as_seconds_f32()
677-
);
671+
println!("Fetched header hashes in {}", start.elapsed().as_secs_f32());
678672

679-
let start = time::Instant::now();
673+
let start = Instant::now();
680674
let mut total_load_headers = 0;
681675

682676
for (consensus_hash, block_hash_opt) in header_hashes.iter() {
@@ -736,7 +730,7 @@ check if the associated microblocks can be downloaded
736730

737731
println!(
738732
"Checked can_download in {} (headers load took {}ms)",
739-
start.elapsed().as_seconds_f32(),
733+
start.elapsed().as_secs_f32(),
740734
total_load_headers
741735
);
742736

0 commit comments

Comments
 (0)