Skip to content

Remove -A clippy::uninlined-format-args from clippy-stacks and fix all warnings #6278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 14, 2025
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[alias]
stacks-node = "run --package stacks-node --"
fmt-stacks = "fmt -- --config group_imports=StdExternalCrate,imports_granularity=Module"
clippy-stacks = "clippy -p stx-genesis -p libstackerdb -p stacks-signer -p pox-locking -p clarity -p libsigner -p stacks-common --no-deps --tests --all-features -- -D warnings -A clippy::uninlined-format-args"
clippy-stacks = "clippy -p stx-genesis -p libstackerdb -p stacks-signer -p pox-locking -p clarity -p libsigner -p stacks-common --no-deps --tests --all-features -- -D warnings"
clippy-stackslib = "clippy -p stackslib --no-deps -- -Aclippy::all -Wclippy::indexing_slicing"

# Uncomment to improve performance slightly, at the cost of portability
Expand Down
2 changes: 1 addition & 1 deletion clarity/src/vm/analysis/arithmetic_checker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl std::error::Error for Error {

impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
write!(f, "{self:?}")
}
}

Expand Down
21 changes: 7 additions & 14 deletions clarity/src/vm/analysis/arithmetic_checker/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ fn test_bad_defines(#[case] version: ClarityVersion, #[case] epoch: StacksEpochI
assert_eq!(
arithmetic_check(contract, version, epoch),
Err(error.clone()),
"Check contract:\n {}",
contract
"Check contract:\n {contract}"
);
}
}
Expand Down Expand Up @@ -120,14 +119,12 @@ fn test_variables_fail_arithmetic_check_clarity1() {
assert_eq!(
arithmetic_check(contract, ClarityVersion::Clarity1, StacksEpochId::Epoch2_05),
result.clone(),
"Check contract:\n {}",
contract
"Check contract:\n {contract}"
);
assert_eq!(
arithmetic_check(contract, ClarityVersion::Clarity1, StacksEpochId::Epoch21),
result.clone(),
"Check contract:\n {}",
contract
"Check contract:\n {contract}"
);
}

Expand Down Expand Up @@ -188,8 +185,7 @@ fn test_variables_fail_arithmetic_check_clarity2() {
assert_eq!(
arithmetic_check(contract, ClarityVersion::Clarity2, StacksEpochId::Epoch21),
result.clone(),
"Check contract:\n {}",
contract
"Check contract:\n {contract}"
);
}
}
Expand Down Expand Up @@ -321,14 +317,12 @@ fn test_functions_clarity1() {
assert_eq!(
arithmetic_check(contract, ClarityVersion::Clarity1, StacksEpochId::Epoch2_05),
result.clone(),
"Check contract:\n {}",
contract
"Check contract:\n {contract}"
);
assert_eq!(
arithmetic_check(contract, ClarityVersion::Clarity1, StacksEpochId::Epoch21),
result.clone(),
"Check contract:\n {}",
contract
"Check contract:\n {contract}"
);
}
}
Expand Down Expand Up @@ -458,8 +452,7 @@ fn test_functions_clarity2() {
assert_eq!(
arithmetic_check(contract, ClarityVersion::Clarity2, StacksEpochId::Epoch21),
result.clone(),
"Check contract:\n {}",
contract
"Check contract:\n {contract}"
);
}
}
Expand Down
106 changes: 53 additions & 53 deletions clarity/src/vm/analysis/errors.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion clarity/src/vm/analysis/read_only_checker/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ fn test_at_block_violations() {

for contract in examples.iter() {
let err = mem_type_check(contract).unwrap_err();
eprintln!("{}", err);
eprintln!("{err}");
assert_eq!(err.err, CheckErrors::AtBlockClosureMustBeReadOnly)
}
}
Expand Down
58 changes: 29 additions & 29 deletions clarity/src/vm/analysis/trait_checker/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ fn test_incomplete_impl_trait_1(#[case] version: ClarityVersion, #[case] epoch:
.unwrap_err();
match err.err {
CheckErrors::BadTraitImplementation(_, _) => {}
_ => panic!("{:?}", err),
_ => panic!("{err:?}"),
}
}

Expand All @@ -126,7 +126,7 @@ fn test_incomplete_impl_trait_2(#[case] version: ClarityVersion, #[case] epoch:
.unwrap_err();
match err.err {
CheckErrors::BadTraitImplementation(_, _) => {}
_ => panic!("{:?}", err),
_ => panic!("{err:?}"),
}
}

Expand All @@ -150,7 +150,7 @@ fn test_impl_trait_arg_admission_1(#[case] version: ClarityVersion, #[case] epoc
.unwrap_err();
match err.err {
CheckErrors::BadTraitImplementation(_, _) => {}
_ => panic!("{:?}", err),
_ => panic!("{err:?}"),
}
}

Expand Down Expand Up @@ -290,7 +290,7 @@ fn test_get_trait_reference_from_tuple(
.unwrap_err();
match err.err {
CheckErrors::ContractCallExpectName => {}
_ => panic!("{:?}", err),
_ => panic!("{err:?}"),
}
}

Expand Down Expand Up @@ -333,7 +333,7 @@ fn test_dynamic_dispatch_by_defining_and_impl_trait(
.unwrap_err();
match err.err {
CheckErrors::TraitReferenceUnknown(_) => {}
_ => panic!("{:?}", err),
_ => panic!("{err:?}"),
}
}

Expand All @@ -360,7 +360,7 @@ fn test_define_map_storing_trait_references(

match err.err {
ParseErrors::TraitReferenceNotAllowed => {}
_ => panic!("{:?}", err),
_ => panic!("{err:?}"),
}
}

Expand All @@ -384,7 +384,7 @@ fn test_cycle_in_traits_1_contract(#[case] version: ClarityVersion, #[case] epoc
.unwrap_err();
match err.err {
ParseErrors::CircularReference(_) => {}
_ => panic!("{:?}", err),
_ => panic!("{err:?}"),
}
}

Expand Down Expand Up @@ -435,7 +435,7 @@ fn test_cycle_in_traits_2_contracts(#[case] version: ClarityVersion, #[case] epo
.unwrap_err();
match err.err {
CheckErrors::NoSuchContract(_) => {}
_ => panic!("{:?}", err),
_ => panic!("{err:?}"),
}
}

Expand Down Expand Up @@ -488,7 +488,7 @@ fn test_dynamic_dispatch_unknown_method(
.unwrap_err();
match err.err {
CheckErrors::TraitMethodUnknown(_, _) => {}
_ => panic!("{:?}", err),
_ => panic!("{err:?}"),
}
}

Expand Down Expand Up @@ -672,7 +672,7 @@ fn test_dynamic_dispatch_collision_trait(
.unwrap_err();
match err.err {
ParseErrors::NameAlreadyUsed(_) => {}
_ => panic!("{:?}", err),
_ => panic!("{err:?}"),
}
}

Expand Down Expand Up @@ -701,7 +701,7 @@ fn test_dynamic_dispatch_collision_defined_trait(
.unwrap_err();
match err.err {
ParseErrors::NameAlreadyUsed(_) => {}
_ => panic!("{:?}", err),
_ => panic!("{err:?}"),
}
}

Expand Down Expand Up @@ -741,7 +741,7 @@ fn test_dynamic_dispatch_collision_imported_trait(
.unwrap_err();
match err.err {
ParseErrors::NameAlreadyUsed(_) => {}
_ => panic!("{:?}", err),
_ => panic!("{err:?}"),
}
}

Expand Down Expand Up @@ -813,7 +813,7 @@ fn test_dynamic_dispatch_importing_non_existant_trait(
.unwrap_err();
match err.err {
CheckErrors::TraitReferenceUnknown(_) => {}
_ => panic!("{:?}", err),
_ => panic!("{err:?}"),
}
}

Expand Down Expand Up @@ -1106,7 +1106,7 @@ fn test_dynamic_dispatch_including_wrong_nested_trait(
CheckErrors::TypeError(TypeSignature::CallableType(_), TypeSignature::CallableType(_))
if epoch >= StacksEpochId::Epoch21 && version < ClarityVersion::Clarity2 => {}
CheckErrors::TraitReferenceUnknown(name) => assert_eq!(name.as_str(), "trait-a"),
_ => panic!("{:?}", err),
_ => panic!("{err:?}"),
}
}

Expand Down Expand Up @@ -1160,7 +1160,7 @@ fn test_dynamic_dispatch_mismatched_args(
.unwrap_err();
match err.err {
CheckErrors::TypeError(_, _) => {}
_ => panic!("{:?}", err),
_ => panic!("{err:?}"),
}
}

Expand Down Expand Up @@ -1214,7 +1214,7 @@ fn test_dynamic_dispatch_mismatched_returns(
.unwrap_err();
match err.err {
CheckErrors::BadTraitImplementation(_, _) => {}
_ => panic!("{:?}", err),
_ => panic!("{err:?}"),
}
}

Expand Down Expand Up @@ -1250,7 +1250,7 @@ fn test_bad_call_with_trait(#[case] version: ClarityVersion, #[case] epoch: Stac
.unwrap_err();
match err.err {
CheckErrors::TypeError(_, _) => {}
_ => panic!("{:?}", err),
_ => panic!("{err:?}"),
}
}

Expand All @@ -1276,7 +1276,7 @@ fn test_good_call_with_trait(#[case] version: ClarityVersion, #[case] epoch: Sta
let mut marf = MemoryBackingStore::new();
let mut db = marf.as_analysis_db();

println!("c4: {:?}", c4);
println!("c4: {c4:?}");

db.execute(|db| {
type_check(&def_contract_id, &mut c1, db, true, &epoch, &version).unwrap();
Expand Down Expand Up @@ -1310,7 +1310,7 @@ fn test_good_call_2_with_trait(#[case] version: ClarityVersion, #[case] epoch: S
let mut marf = MemoryBackingStore::new();
let mut db = marf.as_analysis_db();

println!("c4: {:?}", c4);
println!("c4: {c4:?}");

db.execute(|db| {
type_check(&def_contract_id, &mut c1, db, true, &epoch, &version).unwrap();
Expand Down Expand Up @@ -1459,11 +1459,11 @@ fn test_dynamic_dispatch_pass_bound_principal_as_trait_in_user_defined_functions
Err(err) if version == ClarityVersion::Clarity1 => {
match err.err {
CheckErrors::TypeError(_, _) => {}
_ => panic!("{:?}", err),
_ => panic!("{err:?}"),
};
}
Ok(_) if version >= ClarityVersion::Clarity2 => (),
_ => panic!("got {:?}", result),
_ => panic!("got {result:?}"),
}
}

Expand Down Expand Up @@ -1553,7 +1553,7 @@ fn test_contract_of_wrong_type(#[case] version: ClarityVersion, #[case] epoch: S
.unwrap_err();
match err_principal.err {
CheckErrors::TraitReferenceUnknown(_) => {}
_ => panic!("{:?}", err_principal),
_ => panic!("{err_principal:?}"),
}
let err_int = db
.execute(|db| {
Expand All @@ -1563,7 +1563,7 @@ fn test_contract_of_wrong_type(#[case] version: ClarityVersion, #[case] epoch: S
.unwrap_err();
match err_int.err {
CheckErrors::TraitReferenceUnknown(_) => {}
_ => panic!("{:?}", err_int),
_ => panic!("{err_int:?}"),
}
let err_uint = db
.execute(|db| {
Expand All @@ -1573,7 +1573,7 @@ fn test_contract_of_wrong_type(#[case] version: ClarityVersion, #[case] epoch: S
.unwrap_err();
match err_uint.err {
CheckErrors::TraitReferenceUnknown(_) => {}
_ => panic!("{:?}", err_uint),
_ => panic!("{err_uint:?}"),
}
let err_bool = db
.execute(|db| {
Expand All @@ -1583,7 +1583,7 @@ fn test_contract_of_wrong_type(#[case] version: ClarityVersion, #[case] epoch: S
.unwrap_err();
match err_bool.err {
CheckErrors::TraitReferenceUnknown(_) => {}
_ => panic!("{:?}", err_bool),
_ => panic!("{err_bool:?}"),
}
let err_list = db
.execute(|db| {
Expand All @@ -1593,7 +1593,7 @@ fn test_contract_of_wrong_type(#[case] version: ClarityVersion, #[case] epoch: S
.unwrap_err();
match err_list.err {
CheckErrors::TraitReferenceUnknown(_) => {}
_ => panic!("{:?}", err_list),
_ => panic!("{err_list:?}"),
}
let err_buff = db
.execute(|db| {
Expand All @@ -1603,7 +1603,7 @@ fn test_contract_of_wrong_type(#[case] version: ClarityVersion, #[case] epoch: S
.unwrap_err();
match err_buff.err {
CheckErrors::TraitReferenceUnknown(_) => {}
_ => panic!("{:?}", err_buff),
_ => panic!("{err_buff:?}"),
}
let err_tuple = db
.execute(|db| {
Expand All @@ -1613,7 +1613,7 @@ fn test_contract_of_wrong_type(#[case] version: ClarityVersion, #[case] epoch: S
.unwrap_err();
match err_tuple.err {
CheckErrors::TraitReferenceUnknown(_) => {}
_ => panic!("{:?}", err_tuple),
_ => panic!("{err_tuple:?}"),
}
}

Expand Down Expand Up @@ -1816,6 +1816,6 @@ fn test_trait_contract_not_found(#[case] version: ClarityVersion, #[case] epoch:
diagnostic: _,
}) if version < ClarityVersion::Clarity2 => assert!(contract.ends_with(".trait-contract")),
Ok(_) if version >= ClarityVersion::Clarity2 => (),
res => panic!("{}: {:?}", version, res),
res => panic!("{version}: {res:?}"),
}
}
4 changes: 2 additions & 2 deletions clarity/src/vm/analysis/type_checker/v2_05/tests/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,14 @@ fn test_bad_asset_usage() {
];

for (script, expected_err) in bad_scripts.iter().zip(expected.iter()) {
let tokens_contract = format!("{}\n{}", FIRST_CLASS_TOKENS, script);
let tokens_contract = format!("{FIRST_CLASS_TOKENS}\n{script}");
let actual_err = mem_type_check(
&tokens_contract,
ClarityVersion::Clarity1,
StacksEpochId::Epoch2_05,
)
.unwrap_err();
println!("{}", script);
println!("{script}");
assert_eq!(&actual_err.err, expected_err);
}
}
Loading
Loading