Skip to content

Commit f95d1a6

Browse files
authored
[move][clippy] Apply clippy CI check to all targets (#17165)
## Description - cargo move-clippy did not include tests ## Test plan - CI --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK:
1 parent 2533e1e commit f95d1a6

File tree

15 files changed

+54
-56
lines changed

15 files changed

+54
-56
lines changed

crates/bytecode-verifier-tests/src/unit_tests/bounds_tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ fn invalid_signature_for_vector_operation() {
222222

223223
let skeleton = basic_test_module();
224224
let sig_index = SignatureIndex(skeleton.signatures.len() as u16);
225-
for bytecode in vec![
225+
for bytecode in [
226226
VecPack(sig_index, 0),
227227
VecLen(sig_index),
228228
VecImmBorrow(sig_index),
@@ -251,7 +251,7 @@ fn invalid_struct_for_vector_operation() {
251251
.signatures
252252
.push(Signature(vec![Struct(StructHandleIndex::new(3))]));
253253
let sig_index = SignatureIndex((skeleton.signatures.len() - 1) as u16);
254-
for bytecode in vec![
254+
for bytecode in [
255255
VecPack(sig_index, 0),
256256
VecLen(sig_index),
257257
VecImmBorrow(sig_index),
@@ -278,7 +278,7 @@ fn invalid_type_param_for_vector_operation() {
278278
let mut skeleton = basic_test_module();
279279
skeleton.signatures.push(Signature(vec![TypeParameter(0)]));
280280
let sig_index = SignatureIndex((skeleton.signatures.len() - 1) as u16);
281-
for bytecode in vec![
281+
for bytecode in [
282282
VecPack(sig_index, 0),
283283
VecLen(sig_index),
284284
VecImmBorrow(sig_index),

crates/invalid-mutations/src/bounds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ fn struct_handle(token: &SignatureToken) -> Option<StructHandleIndex> {
359359
StructInstantiation(struct_inst) => {
360360
let (sh_idx, _) = &**struct_inst;
361361
Some(*sh_idx)
362-
},
362+
}
363363
Reference(token) | MutableReference(token) => struct_handle(token),
364364
Bool | U8 | U16 | U32 | U64 | U128 | U256 | Address | Signer | Vector(_)
365365
| TypeParameter(_) => None,

crates/move-analyzer/src/symbols.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3807,11 +3807,10 @@ fn assert_use_def_with_doc_string(
38073807
"for use in column {use_col} of line {use_line} in file {use_file}"
38083808
);
38093809
let info = def_info.get(&use_def.def_loc).unwrap();
3810+
let info_str = info.to_string();
38103811
assert!(
3811-
type_str == format!("{}", info),
3812-
"'{}' != '{}' for use in column {use_col} of line {use_line} in file {use_file}",
3813-
type_str,
3814-
format!("{}", info)
3812+
type_str == info_str,
3813+
"'{type_str}' != '{info}' for use in column {use_col} of line {use_line} in file {use_file}",
38153814
);
38163815

38173816
if doc_string.is_some() {

crates/move-binary-format/src/binary_config.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) The Move Contributors
22
// SPDX-License-Identifier: Apache-2.0
33

4-
54
use crate::file_format_common::VERSION_MAX;
65

76
/// Configuration for the binary format related to table size.
@@ -98,4 +97,3 @@ impl BinaryConfig {
9897
}
9998
}
10099
}
101-

crates/move-binary-format/src/proptest_types/functions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ impl BytecodeGen {
822822
type_arguments
823823
.iter()
824824
.all(BytecodeGen::check_signature_token)
825-
},
825+
}
826826
Reference(_) | MutableReference(_) => false,
827827
}
828828
}

crates/move-binary-format/src/proptest_types/signature.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,10 @@ impl SignatureTokenGen {
190190
_ => type_params.push(SignatureToken::U64),
191191
}
192192
}
193-
SignatureToken::StructInstantiation(Box::new(
194-
(
195-
StructHandleIndex(struct_idx as TableIndex),
196-
type_params,
197-
)
198-
))
193+
SignatureToken::StructInstantiation(Box::new((
194+
StructHandleIndex(struct_idx as TableIndex),
195+
type_params,
196+
)))
199197
}
200198
}
201199
}

crates/move-binary-format/src/unit_tests/binary_limits_tests.rs

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44

55
use crate::{
66
binary_config::{BinaryConfig, TableConfig},
7-
CompiledModule,
87
errors::BinaryLoaderResult,
98
file_format::*,
9+
CompiledModule,
1010
};
1111
use move_core_types::{
12-
account_address::AccountAddress,
13-
identifier::Identifier,
14-
vm_status::StatusCode,
12+
account_address::AccountAddress, identifier::Identifier, vm_status::StatusCode,
1513
};
1614
// Add simple proptest tests
1715
// use proptest::prelude::*;
@@ -25,7 +23,7 @@ fn deserialize(
2523
let mut bytes = vec![];
2624
module.serialize(&mut bytes).unwrap();
2725
// deserialize the module just serialized (round trip)
28-
CompiledModule::deserialize_with_config(&bytes, &binary_config)
26+
CompiledModule::deserialize_with_config(&bytes, binary_config)
2927
}
3028

3129
//
@@ -273,12 +271,10 @@ fn binary_limits_test() {
273271
});
274272
module_test.struct_defs.push(StructDefinition {
275273
struct_handle: StructHandleIndex(0),
276-
field_information: StructFieldInformation::Declared(vec![
277-
FieldDefinition {
278-
name: IdentifierIndex(0),
279-
signature: TypeSignature(SignatureToken::Bool),
280-
},
281-
]),
274+
field_information: StructFieldInformation::Declared(vec![FieldDefinition {
275+
name: IdentifierIndex(0),
276+
signature: TypeSignature(SignatureToken::Bool),
277+
}]),
282278
});
283279
check_limit!(
284280
module_test,
@@ -301,12 +297,10 @@ fn binary_limits_test() {
301297
});
302298
module_test.struct_defs.push(StructDefinition {
303299
struct_handle: StructHandleIndex(0),
304-
field_information: StructFieldInformation::Declared(vec![
305-
FieldDefinition {
306-
name: IdentifierIndex(0),
307-
signature: TypeSignature(SignatureToken::Bool),
308-
},
309-
]),
300+
field_information: StructFieldInformation::Declared(vec![FieldDefinition {
301+
name: IdentifierIndex(0),
302+
signature: TypeSignature(SignatureToken::Bool),
303+
}]),
310304
});
311305
module_test.field_handles.push(FieldHandle {
312306
owner: StructDefinitionIndex(0),

crates/move-binary-format/src/unit_tests/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
// Copyright (c) The Move Contributors
33
// SPDX-License-Identifier: Apache-2.0
44

5+
mod binary_limits_tests;
56
mod binary_tests;
67
mod compatibility_tests;
78
mod control_flow_graph_tests;
89
mod deserializer_tests;
910
mod number_tests;
1011
mod signature_token_tests;
11-
mod binary_limits_tests;

crates/move-core-types/src/unit_tests/visitor_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ fn nested_typed_struct_visit() {
353353

354354
let mut struct_visitor = PrintVisitor::default();
355355
let from_struct =
356-
MoveStruct::visit_deserialize(&bytes, &struct_layout, &mut struct_visitor).unwrap();
356+
MoveStruct::visit_deserialize(&bytes, struct_layout, &mut struct_visitor).unwrap();
357357

358358
let expected_output = r#"
359359
[0] struct 0x0::foo::Bar {

crates/move-package/tests/test_lock_file.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ fn update_lock_file_toolchain_version() {
160160
let move_manifest = pkg.path().join("Move.toml");
161161
// The 2024.beta in the manifest should override defaults.
162162
fs::write(
163-
&move_manifest,
163+
move_manifest,
164164
r#"
165165
[package]
166166
name = "test"
@@ -184,8 +184,7 @@ fn update_lock_file_toolchain_version() {
184184
lock_file: Some(lock_path.clone()),
185185
..Default::default()
186186
};
187-
let _ =
188-
build_config.update_lock_file_toolchain_version(&pkg.path().to_path_buf(), "0.0.1".into());
187+
let _ = build_config.update_lock_file_toolchain_version(pkg.path(), "0.0.1".into());
189188

190189
let mut lock_file = File::open(lock_path).unwrap();
191190
let toolchain_version =
@@ -220,7 +219,7 @@ fn test_update_managed_address() {
220219
let mut lock = LockFile::from(pb, &lock_path).unwrap();
221220
update_managed_address(
222221
&mut lock,
223-
"default".into(),
222+
"default",
224223
ManagedAddressUpdate::Published {
225224
original_id: "0x123".into(),
226225
chain_id: "35834a8a".into(),
@@ -230,7 +229,7 @@ fn test_update_managed_address() {
230229

231230
update_managed_address(
232231
&mut lock,
233-
"default".into(),
232+
"default",
234233
ManagedAddressUpdate::Upgraded {
235234
latest_id: "0x456".into(),
236235
version: 2,

0 commit comments

Comments
 (0)