Skip to content

Commit fe32c74

Browse files
authored
Merge pull request #6278 from jferrant/chore/fix-clippy-format-args
Remove -A clippy::uninlined-format-args from clippy-stacks and fix all warnings
2 parents 7d63003 + e26b9ea commit fe32c74

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+565
-701
lines changed

.cargo/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[alias]
22
stacks-node = "run --package stacks-node --"
33
fmt-stacks = "fmt -- --config group_imports=StdExternalCrate,imports_granularity=Module"
4-
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"
4+
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"
55
clippy-stackslib = "clippy -p stackslib --no-deps -- -Aclippy::all -Wclippy::indexing_slicing"
66

77
# Uncomment to improve performance slightly, at the cost of portability

clarity/src/vm/analysis/arithmetic_checker/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl std::error::Error for Error {
5858

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

clarity/src/vm/analysis/arithmetic_checker/tests.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ fn test_bad_defines(#[case] version: ClarityVersion, #[case] epoch: StacksEpochI
7777
assert_eq!(
7878
arithmetic_check(contract, version, epoch),
7979
Err(error.clone()),
80-
"Check contract:\n {}",
81-
contract
80+
"Check contract:\n {contract}"
8281
);
8382
}
8483
}
@@ -120,14 +119,12 @@ fn test_variables_fail_arithmetic_check_clarity1() {
120119
assert_eq!(
121120
arithmetic_check(contract, ClarityVersion::Clarity1, StacksEpochId::Epoch2_05),
122121
result.clone(),
123-
"Check contract:\n {}",
124-
contract
122+
"Check contract:\n {contract}"
125123
);
126124
assert_eq!(
127125
arithmetic_check(contract, ClarityVersion::Clarity1, StacksEpochId::Epoch21),
128126
result.clone(),
129-
"Check contract:\n {}",
130-
contract
127+
"Check contract:\n {contract}"
131128
);
132129
}
133130

@@ -188,8 +185,7 @@ fn test_variables_fail_arithmetic_check_clarity2() {
188185
assert_eq!(
189186
arithmetic_check(contract, ClarityVersion::Clarity2, StacksEpochId::Epoch21),
190187
result.clone(),
191-
"Check contract:\n {}",
192-
contract
188+
"Check contract:\n {contract}"
193189
);
194190
}
195191
}
@@ -321,14 +317,12 @@ fn test_functions_clarity1() {
321317
assert_eq!(
322318
arithmetic_check(contract, ClarityVersion::Clarity1, StacksEpochId::Epoch2_05),
323319
result.clone(),
324-
"Check contract:\n {}",
325-
contract
320+
"Check contract:\n {contract}"
326321
);
327322
assert_eq!(
328323
arithmetic_check(contract, ClarityVersion::Clarity1, StacksEpochId::Epoch21),
329324
result.clone(),
330-
"Check contract:\n {}",
331-
contract
325+
"Check contract:\n {contract}"
332326
);
333327
}
334328
}
@@ -458,8 +452,7 @@ fn test_functions_clarity2() {
458452
assert_eq!(
459453
arithmetic_check(contract, ClarityVersion::Clarity2, StacksEpochId::Epoch21),
460454
result.clone(),
461-
"Check contract:\n {}",
462-
contract
455+
"Check contract:\n {contract}"
463456
);
464457
}
465458
}

clarity/src/vm/analysis/errors.rs

Lines changed: 53 additions & 53 deletions
Large diffs are not rendered by default.

clarity/src/vm/analysis/read_only_checker/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn test_at_block_violations() {
7171

7272
for contract in examples.iter() {
7373
let err = mem_type_check(contract).unwrap_err();
74-
eprintln!("{}", err);
74+
eprintln!("{err}");
7575
assert_eq!(err.err, CheckErrors::AtBlockClosureMustBeReadOnly)
7676
}
7777
}

clarity/src/vm/analysis/trait_checker/tests.rs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn test_incomplete_impl_trait_1(#[case] version: ClarityVersion, #[case] epoch:
9999
.unwrap_err();
100100
match err.err {
101101
CheckErrors::BadTraitImplementation(_, _) => {}
102-
_ => panic!("{:?}", err),
102+
_ => panic!("{err:?}"),
103103
}
104104
}
105105

@@ -126,7 +126,7 @@ fn test_incomplete_impl_trait_2(#[case] version: ClarityVersion, #[case] epoch:
126126
.unwrap_err();
127127
match err.err {
128128
CheckErrors::BadTraitImplementation(_, _) => {}
129-
_ => panic!("{:?}", err),
129+
_ => panic!("{err:?}"),
130130
}
131131
}
132132

@@ -150,7 +150,7 @@ fn test_impl_trait_arg_admission_1(#[case] version: ClarityVersion, #[case] epoc
150150
.unwrap_err();
151151
match err.err {
152152
CheckErrors::BadTraitImplementation(_, _) => {}
153-
_ => panic!("{:?}", err),
153+
_ => panic!("{err:?}"),
154154
}
155155
}
156156

@@ -290,7 +290,7 @@ fn test_get_trait_reference_from_tuple(
290290
.unwrap_err();
291291
match err.err {
292292
CheckErrors::ContractCallExpectName => {}
293-
_ => panic!("{:?}", err),
293+
_ => panic!("{err:?}"),
294294
}
295295
}
296296

@@ -333,7 +333,7 @@ fn test_dynamic_dispatch_by_defining_and_impl_trait(
333333
.unwrap_err();
334334
match err.err {
335335
CheckErrors::TraitReferenceUnknown(_) => {}
336-
_ => panic!("{:?}", err),
336+
_ => panic!("{err:?}"),
337337
}
338338
}
339339

@@ -360,7 +360,7 @@ fn test_define_map_storing_trait_references(
360360

361361
match err.err {
362362
ParseErrors::TraitReferenceNotAllowed => {}
363-
_ => panic!("{:?}", err),
363+
_ => panic!("{err:?}"),
364364
}
365365
}
366366

@@ -384,7 +384,7 @@ fn test_cycle_in_traits_1_contract(#[case] version: ClarityVersion, #[case] epoc
384384
.unwrap_err();
385385
match err.err {
386386
ParseErrors::CircularReference(_) => {}
387-
_ => panic!("{:?}", err),
387+
_ => panic!("{err:?}"),
388388
}
389389
}
390390

@@ -435,7 +435,7 @@ fn test_cycle_in_traits_2_contracts(#[case] version: ClarityVersion, #[case] epo
435435
.unwrap_err();
436436
match err.err {
437437
CheckErrors::NoSuchContract(_) => {}
438-
_ => panic!("{:?}", err),
438+
_ => panic!("{err:?}"),
439439
}
440440
}
441441

@@ -488,7 +488,7 @@ fn test_dynamic_dispatch_unknown_method(
488488
.unwrap_err();
489489
match err.err {
490490
CheckErrors::TraitMethodUnknown(_, _) => {}
491-
_ => panic!("{:?}", err),
491+
_ => panic!("{err:?}"),
492492
}
493493
}
494494

@@ -672,7 +672,7 @@ fn test_dynamic_dispatch_collision_trait(
672672
.unwrap_err();
673673
match err.err {
674674
ParseErrors::NameAlreadyUsed(_) => {}
675-
_ => panic!("{:?}", err),
675+
_ => panic!("{err:?}"),
676676
}
677677
}
678678

@@ -701,7 +701,7 @@ fn test_dynamic_dispatch_collision_defined_trait(
701701
.unwrap_err();
702702
match err.err {
703703
ParseErrors::NameAlreadyUsed(_) => {}
704-
_ => panic!("{:?}", err),
704+
_ => panic!("{err:?}"),
705705
}
706706
}
707707

@@ -741,7 +741,7 @@ fn test_dynamic_dispatch_collision_imported_trait(
741741
.unwrap_err();
742742
match err.err {
743743
ParseErrors::NameAlreadyUsed(_) => {}
744-
_ => panic!("{:?}", err),
744+
_ => panic!("{err:?}"),
745745
}
746746
}
747747

@@ -813,7 +813,7 @@ fn test_dynamic_dispatch_importing_non_existant_trait(
813813
.unwrap_err();
814814
match err.err {
815815
CheckErrors::TraitReferenceUnknown(_) => {}
816-
_ => panic!("{:?}", err),
816+
_ => panic!("{err:?}"),
817817
}
818818
}
819819

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

@@ -1160,7 +1160,7 @@ fn test_dynamic_dispatch_mismatched_args(
11601160
.unwrap_err();
11611161
match err.err {
11621162
CheckErrors::TypeError(_, _) => {}
1163-
_ => panic!("{:?}", err),
1163+
_ => panic!("{err:?}"),
11641164
}
11651165
}
11661166

@@ -1214,7 +1214,7 @@ fn test_dynamic_dispatch_mismatched_returns(
12141214
.unwrap_err();
12151215
match err.err {
12161216
CheckErrors::BadTraitImplementation(_, _) => {}
1217-
_ => panic!("{:?}", err),
1217+
_ => panic!("{err:?}"),
12181218
}
12191219
}
12201220

@@ -1250,7 +1250,7 @@ fn test_bad_call_with_trait(#[case] version: ClarityVersion, #[case] epoch: Stac
12501250
.unwrap_err();
12511251
match err.err {
12521252
CheckErrors::TypeError(_, _) => {}
1253-
_ => panic!("{:?}", err),
1253+
_ => panic!("{err:?}"),
12541254
}
12551255
}
12561256

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

1279-
println!("c4: {:?}", c4);
1279+
println!("c4: {c4:?}");
12801280

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

1313-
println!("c4: {:?}", c4);
1313+
println!("c4: {c4:?}");
13141314

13151315
db.execute(|db| {
13161316
type_check(&def_contract_id, &mut c1, db, true, &epoch, &version).unwrap();
@@ -1459,11 +1459,11 @@ fn test_dynamic_dispatch_pass_bound_principal_as_trait_in_user_defined_functions
14591459
Err(err) if version == ClarityVersion::Clarity1 => {
14601460
match err.err {
14611461
CheckErrors::TypeError(_, _) => {}
1462-
_ => panic!("{:?}", err),
1462+
_ => panic!("{err:?}"),
14631463
};
14641464
}
14651465
Ok(_) if version >= ClarityVersion::Clarity2 => (),
1466-
_ => panic!("got {:?}", result),
1466+
_ => panic!("got {result:?}"),
14671467
}
14681468
}
14691469

@@ -1553,7 +1553,7 @@ fn test_contract_of_wrong_type(#[case] version: ClarityVersion, #[case] epoch: S
15531553
.unwrap_err();
15541554
match err_principal.err {
15551555
CheckErrors::TraitReferenceUnknown(_) => {}
1556-
_ => panic!("{:?}", err_principal),
1556+
_ => panic!("{err_principal:?}"),
15571557
}
15581558
let err_int = db
15591559
.execute(|db| {
@@ -1563,7 +1563,7 @@ fn test_contract_of_wrong_type(#[case] version: ClarityVersion, #[case] epoch: S
15631563
.unwrap_err();
15641564
match err_int.err {
15651565
CheckErrors::TraitReferenceUnknown(_) => {}
1566-
_ => panic!("{:?}", err_int),
1566+
_ => panic!("{err_int:?}"),
15671567
}
15681568
let err_uint = db
15691569
.execute(|db| {
@@ -1573,7 +1573,7 @@ fn test_contract_of_wrong_type(#[case] version: ClarityVersion, #[case] epoch: S
15731573
.unwrap_err();
15741574
match err_uint.err {
15751575
CheckErrors::TraitReferenceUnknown(_) => {}
1576-
_ => panic!("{:?}", err_uint),
1576+
_ => panic!("{err_uint:?}"),
15771577
}
15781578
let err_bool = db
15791579
.execute(|db| {
@@ -1583,7 +1583,7 @@ fn test_contract_of_wrong_type(#[case] version: ClarityVersion, #[case] epoch: S
15831583
.unwrap_err();
15841584
match err_bool.err {
15851585
CheckErrors::TraitReferenceUnknown(_) => {}
1586-
_ => panic!("{:?}", err_bool),
1586+
_ => panic!("{err_bool:?}"),
15871587
}
15881588
let err_list = db
15891589
.execute(|db| {
@@ -1593,7 +1593,7 @@ fn test_contract_of_wrong_type(#[case] version: ClarityVersion, #[case] epoch: S
15931593
.unwrap_err();
15941594
match err_list.err {
15951595
CheckErrors::TraitReferenceUnknown(_) => {}
1596-
_ => panic!("{:?}", err_list),
1596+
_ => panic!("{err_list:?}"),
15971597
}
15981598
let err_buff = db
15991599
.execute(|db| {
@@ -1603,7 +1603,7 @@ fn test_contract_of_wrong_type(#[case] version: ClarityVersion, #[case] epoch: S
16031603
.unwrap_err();
16041604
match err_buff.err {
16051605
CheckErrors::TraitReferenceUnknown(_) => {}
1606-
_ => panic!("{:?}", err_buff),
1606+
_ => panic!("{err_buff:?}"),
16071607
}
16081608
let err_tuple = db
16091609
.execute(|db| {
@@ -1613,7 +1613,7 @@ fn test_contract_of_wrong_type(#[case] version: ClarityVersion, #[case] epoch: S
16131613
.unwrap_err();
16141614
match err_tuple.err {
16151615
CheckErrors::TraitReferenceUnknown(_) => {}
1616-
_ => panic!("{:?}", err_tuple),
1616+
_ => panic!("{err_tuple:?}"),
16171617
}
16181618
}
16191619

@@ -1816,6 +1816,6 @@ fn test_trait_contract_not_found(#[case] version: ClarityVersion, #[case] epoch:
18161816
diagnostic: _,
18171817
}) if version < ClarityVersion::Clarity2 => assert!(contract.ends_with(".trait-contract")),
18181818
Ok(_) if version >= ClarityVersion::Clarity2 => (),
1819-
res => panic!("{}: {:?}", version, res),
1819+
res => panic!("{version}: {res:?}"),
18201820
}
18211821
}

clarity/src/vm/analysis/type_checker/v2_05/tests/assets.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,14 @@ fn test_bad_asset_usage() {
235235
];
236236

237237
for (script, expected_err) in bad_scripts.iter().zip(expected.iter()) {
238-
let tokens_contract = format!("{}\n{}", FIRST_CLASS_TOKENS, script);
238+
let tokens_contract = format!("{FIRST_CLASS_TOKENS}\n{script}");
239239
let actual_err = mem_type_check(
240240
&tokens_contract,
241241
ClarityVersion::Clarity1,
242242
StacksEpochId::Epoch2_05,
243243
)
244244
.unwrap_err();
245-
println!("{}", script);
245+
println!("{script}");
246246
assert_eq!(&actual_err.err, expected_err);
247247
}
248248
}

0 commit comments

Comments
 (0)