Skip to content

Commit f87444b

Browse files
authored
Merge pull request #6233 from jferrant/chore/cleanup-unused-imports-clippy
Remove unused imports throughout stacks core
2 parents 0a4f5f1 + 237daea commit f87444b

21 files changed

+123
-153
lines changed

clarity/src/vm/tests/assets.rs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,28 @@
1313
//
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16-
16+
#[cfg(test)]
1717
use stacks_common::types::StacksEpochId;
1818

19-
use crate::vm::ast::ASTRules;
20-
use crate::vm::contexts::{AssetMap, AssetMapEntry, OwnedEnvironment};
21-
use crate::vm::errors::{CheckErrors, Error, RuntimeErrorType};
19+
use crate::vm::contexts::{AssetMap, OwnedEnvironment};
20+
use crate::vm::errors::Error;
2221
use crate::vm::events::StacksTransactionEvent;
2322
use crate::vm::representations::SymbolicExpression;
24-
use crate::vm::tests::{
25-
execute, is_committed, is_err_code, symbols_from_values, test_clarity_versions, test_epochs,
26-
tl_env_factory as env_factory, TopLevelMemoryEnvironmentGenerator,
23+
use crate::vm::tests::{test_clarity_versions, test_epochs};
24+
use crate::vm::types::{PrincipalData, QualifiedContractIdentifier, Value};
25+
#[cfg(test)]
26+
use crate::vm::{
27+
ast::ASTRules,
28+
contexts::AssetMapEntry,
29+
errors::{CheckErrors, RuntimeErrorType},
30+
tests::{
31+
execute, is_committed, is_err_code, symbols_from_values, tl_env_factory as env_factory,
32+
TopLevelMemoryEnvironmentGenerator,
33+
},
34+
types::AssetIdentifier,
35+
version::ClarityVersion,
36+
ContractContext,
2737
};
28-
use crate::vm::types::{AssetIdentifier, PrincipalData, QualifiedContractIdentifier, Value};
29-
use crate::vm::version::ClarityVersion;
30-
use crate::vm::ContractContext;
3138

3239
const FIRST_CLASS_TOKENS: &str = "(define-fungible-token stackaroos)
3340
(define-read-only (my-ft-get-balance (account principal))

clarity/src/vm/tests/contracts.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@
1616

1717
#[cfg(any(test, feature = "testing"))]
1818
use rstest::rstest;
19-
use stacks_common::types::chainstate::BlockHeaderHash;
20-
use stacks_common::types::StacksEpochId;
19+
#[cfg(test)]
20+
use stacks_common::types::{chainstate::BlockHeaderHash, StacksEpochId};
2121

22-
use crate::vm::ast::errors::ParseErrors;
23-
use crate::vm::ast::ASTRules;
2422
use crate::vm::contexts::Environment;
25-
use crate::vm::errors::{CheckErrors, Error, RuntimeErrorType};
26-
use crate::vm::tests::{
27-
env_factory, execute, is_committed, is_err_code_i128 as is_err_code, symbols_from_values,
28-
test_clarity_versions, test_epochs, tl_env_factory, MemoryEnvironmentGenerator,
29-
TopLevelMemoryEnvironmentGenerator,
23+
use crate::vm::tests::{test_clarity_versions, test_epochs};
24+
use crate::vm::types::{PrincipalData, QualifiedContractIdentifier, StandardPrincipalData, Value};
25+
#[cfg(test)]
26+
use crate::vm::{
27+
ast::{errors::ParseErrors, ASTRules},
28+
errors::{CheckErrors, Error, RuntimeErrorType},
29+
tests::{
30+
env_factory, execute, is_committed, is_err_code_i128 as is_err_code, symbols_from_values,
31+
tl_env_factory, MemoryEnvironmentGenerator, TopLevelMemoryEnvironmentGenerator,
32+
},
33+
types::{OptionalData, ResponseData, TypeSignature},
34+
{execute as vm_execute, ClarityVersion, ContractContext},
3035
};
31-
use crate::vm::types::{
32-
OptionalData, PrincipalData, QualifiedContractIdentifier, ResponseData, StandardPrincipalData,
33-
TypeSignature, Value,
34-
};
35-
use crate::vm::{execute as vm_execute, ClarityVersion, ContractContext};
3636

3737
const FACTORIAL_CONTRACT: &str = "(define-map factorials { id: int } { current: int, index: int })
3838
(define-private (init-factorial (id int) (factorial int))

clarity/src/vm/tests/datamaps.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
//
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16-
17-
use crate::vm::errors::{CheckErrors, Error, ShortReturnType};
18-
use crate::vm::types::{
19-
ListData, SequenceData, TupleData, TupleTypeSignature, TypeSignature, Value,
16+
use crate::vm::errors::Error;
17+
use crate::vm::types::{TupleData, Value};
18+
#[cfg(test)]
19+
use crate::vm::{
20+
errors::{CheckErrors, ShortReturnType},
21+
types::{ListData, SequenceData, TupleTypeSignature, TypeSignature},
2022
};
2123
use crate::vm::{execute, ClarityName};
2224

clarity/src/vm/tests/defines.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,21 @@
1818
use rstest::rstest;
1919
#[cfg(test)]
2020
use rstest_reuse::{self, *};
21+
#[cfg(test)]
2122
use stacks_common::types::StacksEpochId;
2223

23-
use crate::vm::ast::build_ast;
24-
use crate::vm::ast::errors::{ParseError, ParseErrors};
25-
use crate::vm::errors::{CheckErrors, Error, RuntimeErrorType};
24+
use crate::vm::errors::{CheckErrors, Error};
2625
use crate::vm::tests::test_clarity_versions;
27-
use crate::vm::types::{QualifiedContractIdentifier, TypeSignature, Value};
28-
use crate::vm::{execute, ClarityVersion};
26+
#[cfg(test)]
27+
use crate::vm::{
28+
ast::{
29+
build_ast,
30+
errors::{ParseError, ParseErrors},
31+
},
32+
errors::RuntimeErrorType,
33+
types::{QualifiedContractIdentifier, TypeSignature, Value},
34+
{execute, ClarityVersion},
35+
};
2936

3037
fn assert_eq_err(e1: CheckErrors, e2: Error) {
3138
let e1: Error = e1.into();

clarity/src/vm/tests/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,17 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17-
#![allow(unused_imports)]
18-
1917
use stacks_common::consts::{CHAIN_ID_MAINNET, CHAIN_ID_TESTNET};
2018
use stacks_common::types::StacksEpochId;
2119

2220
pub use super::test_util::*;
21+
#[cfg(test)]
2322
use super::ClarityVersion;
2423
use crate::vm::contexts::OwnedEnvironment;
2524
pub use crate::vm::database::BurnStateDB;
2625
use crate::vm::database::MemoryBackingStore;
27-
use crate::vm::errors::Error;
28-
use crate::vm::types::Value;
26+
#[cfg(test)]
27+
use crate::{vm::errors::Error, vm::types::Value};
2928

3029
mod assets;
3130
mod contracts;

clarity/src/vm/tests/principals.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
use hashbrown::HashMap;
21
use stacks_common::types::StacksEpochId;
32
use stacks_common::util::hash::hex_bytes;
43

54
use crate::vm::ast::ASTRules;
6-
use crate::vm::errors::CheckErrors;
7-
use crate::vm::functions::principals::PrincipalConstructErrorCode;
8-
use crate::vm::types::TypeSignature::PrincipalType;
95
use crate::vm::types::{
106
ASCIIData, BuffData, CharType, OptionalData, PrincipalData, QualifiedContractIdentifier,
11-
ResponseData, SequenceData, StandardPrincipalData, TupleData, TypeSignature, Value, BUFF_1,
12-
BUFF_20,
7+
SequenceData, StandardPrincipalData, TupleData, Value,
8+
};
9+
#[cfg(test)]
10+
use crate::vm::{
11+
errors::CheckErrors,
12+
functions::principals::PrincipalConstructErrorCode,
13+
types::TypeSignature::PrincipalType,
14+
types::{ResponseData, TypeSignature, BUFF_1, BUFF_20},
1315
};
1416
use crate::vm::{execute_with_parameters, ClarityVersion};
1517

clarity/src/vm/tests/sequences.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,25 @@
1616

1717
use rstest::rstest;
1818
use rstest_reuse::{self, *};
19+
#[cfg(test)]
1920
use stacks_common::types::StacksEpochId;
2021

21-
use crate::vm::errors::{CheckErrors, Error, RuntimeErrorType};
2222
use crate::vm::tests::test_clarity_versions;
23-
use crate::vm::types::signatures::SequenceSubtype;
24-
use crate::vm::types::signatures::SequenceSubtype::{BufferType, StringType};
25-
use crate::vm::types::signatures::StringSubtype::ASCII;
26-
use crate::vm::types::TypeSignature::{BoolType, IntType, SequenceType, UIntType};
27-
use crate::vm::types::{BufferLength, StringSubtype, StringUTF8Length, TypeSignature, Value};
28-
use crate::vm::{execute, execute_v2, ClarityVersion};
23+
#[cfg(test)]
24+
use crate::vm::{
25+
errors::{CheckErrors, Error, RuntimeErrorType},
26+
execute, execute_v2,
27+
types::{
28+
signatures::{
29+
SequenceSubtype::{self, BufferType, StringType},
30+
StringSubtype::ASCII,
31+
},
32+
BufferLength, StringSubtype, StringUTF8Length,
33+
TypeSignature::{self, BoolType, IntType, SequenceType, UIntType},
34+
Value,
35+
},
36+
ClarityVersion,
37+
};
2938

3039
#[test]
3140
fn test_simple_list_admission() {

clarity/src/vm/tests/simple_apply_eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use crate::vm::tests::{execute, test_clarity_versions};
3636
use crate::vm::types::signatures::*;
3737
use crate::vm::types::{
3838
ASCIIData, BuffData, CharType, PrincipalData, QualifiedContractIdentifier, SequenceData,
39-
StacksAddressExtensions, TypeSignature,
39+
TypeSignature,
4040
};
4141
use crate::vm::{
4242
eval, execute as vm_execute, execute_v2 as vm_execute_v2,

clarity/src/vm/tests/traits.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,21 @@
1313
//
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16-
16+
#[cfg(test)]
1717
use stacks_common::types::StacksEpochId;
1818

19+
#[cfg(test)]
1920
use super::MemoryEnvironmentGenerator;
20-
use crate::vm::ast::ASTRules;
21-
use crate::vm::errors::{CheckErrors, Error};
22-
use crate::vm::tests::{
23-
env_factory, execute, symbols_from_values, test_clarity_versions, test_epochs,
21+
use crate::vm::tests::{test_clarity_versions, test_epochs};
22+
#[cfg(test)]
23+
use crate::vm::{
24+
ast::ASTRules,
25+
errors::{CheckErrors, Error},
26+
tests::{env_factory, execute, symbols_from_values},
27+
types::{PrincipalData, QualifiedContractIdentifier, Value},
28+
version::ClarityVersion,
29+
ContractContext,
2430
};
25-
use crate::vm::types::{PrincipalData, QualifiedContractIdentifier, Value};
26-
use crate::vm::version::ClarityVersion;
27-
use crate::vm::ContractContext;
2831

2932
#[apply(test_clarity_versions)]
3033
fn test_dynamic_dispatch_by_defining_trait(

clarity/src/vm/tests/variables.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,20 @@
1616

1717
#[cfg(any(test, feature = "testing"))]
1818
use rstest::rstest;
19+
#[cfg(test)]
1920
use stacks_common::types::StacksEpochId;
2021

22+
use crate::vm::tests::test_clarity_versions;
2123
#[cfg(test)]
22-
use crate::vm::analysis::type_checker::v2_1::tests::contracts::type_check_version;
23-
use crate::vm::analysis::{run_analysis, CheckError};
24-
use crate::vm::ast::{parse, ASTRules};
25-
use crate::vm::database::MemoryBackingStore;
26-
use crate::vm::errors::{CheckErrors, Error};
27-
use crate::vm::tests::{test_clarity_versions, tl_env_factory, TopLevelMemoryEnvironmentGenerator};
28-
use crate::vm::types::{QualifiedContractIdentifier, Value};
29-
use crate::vm::{ClarityVersion, ContractContext};
24+
use crate::vm::{
25+
analysis::type_checker::v2_1::tests::contracts::type_check_version,
26+
ast::{parse, ASTRules},
27+
database::MemoryBackingStore,
28+
errors::{CheckErrors, Error},
29+
tests::{tl_env_factory, TopLevelMemoryEnvironmentGenerator},
30+
types::{QualifiedContractIdentifier, Value},
31+
ClarityVersion, ContractContext,
32+
};
3033

3134
#[apply(test_clarity_versions)]
3235
fn test_block_height(

0 commit comments

Comments
 (0)