Move all use and static statements to top
This change moves a static and use statement that were defined late in
the file to the top of the file.
//! SQL-backed tests for the merkle state implementation
use std::error::Error;
+use std::sync::atomic::{AtomicUsize, Ordering};
use transact::state::merkle::sql::{
backend::{JournalMode, SqliteBackend, SqliteBackendBuilder},
@@ -25,6 +26,8 @@ use transact::{database::btree::BTreeDatabase, state::merkle::INDEXES};
use super::*;
+static GLOBAL_THREAD_COUNT: AtomicUsize = AtomicUsize::new(1);
+
fn new_sql_merkle_state_and_root(
dbpath: &str,
) -> Result<(SqlMerkleState<SqliteBackend>, String), Box<dyn Error>> {
@@ -158,8 +161,6 @@ fn merkle_produce_same_state_as_btree() -> Result<(), Box<dyn Error>> {
})
}
-use std::sync::atomic::{AtomicUsize, Ordering};
-
fn run_test<T>(test: T) -> Result<(), Box<dyn Error>>
where
T: FnOnce(&str) -> Result<(), Box<dyn Error>> + std::panic::UnwindSafe,
@@ -179,8 +180,6 @@ where
}
}
-static GLOBAL_THREAD_COUNT: AtomicUsize = AtomicUsize::new(1);
-
fn temp_db_path() -> String {
let mut temp_dir = std::env::temp_dir();
