Skip to content
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

Fail clippy on warnings, try remove TODO comments #547

Merged
merged 3 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
rustup component add clippy
- name: Check clippy
run: |
cargo clippy --all-targets --workspace --features runtime-benchmarks --features try-runtime
SKIP_WASM_BUILD=1 cargo clippy --all-targets --workspace --features runtime-benchmarks --features try-runtime -- -D warnings
test:
runs-on:
group: laos
Expand Down
4 changes: 2 additions & 2 deletions node/src/chain_spec/laos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ fn generic_chain_config(
name,
id,
chain_type,
move || create_test_genesis_config(),
create_test_genesis_config,
Vec::new(),
None,
protocol_id,
None,
Some(properties()),
Extensions { relay_chain: "rococo-local".into(), para_id: PARA_ID.into() },
Extensions { relay_chain: "rococo-local".into(), para_id: PARA_ID },
)
}

Expand Down
14 changes: 5 additions & 9 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,10 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
path => {
let chain_spec =
chain_spec::laos::ChainSpec::from_json_file(std::path::PathBuf::from(path))?;
if chain_spec.id().starts_with("klaos") {
Box::new(chain_spec::klaos::ChainSpec::from_json_file(std::path::PathBuf::from(
path,
))?)
} else if chain_spec.id().starts_with("giedi") {
Box::new(chain_spec::klaos::ChainSpec::from_json_file(std::path::PathBuf::from(
path,
))?)
} else if chain_spec.id().starts_with("caladan") {
if chain_spec.id().starts_with("klaos") ||
chain_spec.id().starts_with("giedi") ||
chain_spec.id().starts_with("caladan")
{
Box::new(chain_spec::klaos::ChainSpec::from_json_file(std::path::PathBuf::from(
path,
))?)
Expand Down Expand Up @@ -352,6 +347,7 @@ pub fn run() -> Result<()> {

runner.async_run(|_| {
Ok((
#[allow(deprecated)]
cmd.run::<Block, HostFunctionsOf<ParachainNativeExecutor>, _>(Some(
info_provider,
)),
Expand Down
1 change: 1 addition & 0 deletions node/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ impl<Api> EthCompatRuntimeApiCollection for Api where
{
}

#[allow(clippy::too_many_arguments)]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be tackled later if someone wants. didn't want to touch critical node code

pub async fn spawn_frontier_tasks<RuntimeApi, Executor>(
task_manager: &TaskManager,
client: Arc<TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>,
Expand Down
1 change: 1 addition & 0 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ fn build_import_queue(
))
}

#[allow(clippy::too_many_arguments)]
fn start_consensus(
client: Arc<ParachainClient>,
block_import: ParachainBlockImport,
Expand Down
44 changes: 20 additions & 24 deletions pallets/asset-metadata-extender/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn create_token_uri_extension_works() {

assert_eq!(
AssetMetadataExtender::token_uris_by_claimer_and_location(
claimer.clone(),
claimer,
universal_location.clone()
)
.unwrap(),
Expand Down Expand Up @@ -129,7 +129,7 @@ fn get_all_token_uris_and_claimers_from_extensions_works() {
)
.unwrap();
let token_uri = AssetMetadataExtender::token_uris_by_claimer_and_location(
claimer.clone(),
claimer,
universal_location.clone(),
)
.unwrap();
Expand Down Expand Up @@ -166,24 +166,24 @@ fn update_extension_works() {
let token_uri: TokenUriOf<Test> = bounded_vec![2; 10];
let new_token_uri: TokenUriOf<Test> = bounded_vec![3; 10];

create_token_uri_extension(claimer.clone(), universal_location.clone(), token_uri.clone());
create_token_uri_extension(claimer, universal_location.clone(), token_uri.clone());
assert_eq!(
AssetMetadataExtender::token_uris_by_claimer_and_location(
claimer.clone(),
claimer,
universal_location.clone()
)
.unwrap(),
token_uri
);

assert_ok!(AssetMetadataExtender::update_token_uri_extension(
claimer.clone(),
claimer,
universal_location.clone(),
new_token_uri.clone()
));
assert_eq!(
AssetMetadataExtender::token_uris_by_claimer_and_location(
claimer.clone(),
claimer,
universal_location.clone()
)
.unwrap(),
Expand All @@ -202,24 +202,24 @@ fn after_update_extension_it_returns_the_new_value() {
let token_uri: TokenUriOf<Test> = bounded_vec![2; 10];
let new_token_uri: TokenUriOf<Test> = bounded_vec![3; 10];

create_token_uri_extension(claimer.clone(), universal_location.clone(), token_uri.clone());
create_token_uri_extension(claimer, universal_location.clone(), token_uri.clone());
assert_eq!(
AssetMetadataExtender::token_uris_by_claimer_and_location(
claimer.clone(),
claimer,
universal_location.clone()
)
.unwrap(),
token_uri
);

assert_ok!(AssetMetadataExtender::update_token_uri_extension(
claimer.clone(),
claimer,
universal_location.clone(),
new_token_uri.clone()
));
assert_eq!(
AssetMetadataExtender::token_uris_by_claimer_and_location(
claimer.clone(),
claimer,
universal_location.clone()
)
.unwrap(),
Expand All @@ -242,7 +242,7 @@ fn update_extension_fails_if_it_does_not_exist() {

assert_noop!(
AssetMetadataExtender::update_token_uri_extension(
claimer.clone(),
claimer,
universal_location.clone(),
token_uri.clone()
),
Expand All @@ -260,10 +260,10 @@ fn after_update_extension_counter_does_not_increase() {
let token_uri: TokenUriOf<Test> = bounded_vec![2; 10];
let new_token_uri: TokenUriOf<Test> = bounded_vec![3; 10];

create_token_uri_extension(claimer.clone(), universal_location.clone(), token_uri.clone());
create_token_uri_extension(claimer, universal_location.clone(), token_uri.clone());
assert_eq!(AssetMetadataExtender::extensions_counter(universal_location.clone()), 1);
assert_ok!(AssetMetadataExtender::update_token_uri_extension(
claimer.clone(),
claimer,
universal_location.clone(),
new_token_uri.clone()
));
Expand Down Expand Up @@ -295,11 +295,7 @@ fn claimer_by_index_works() {
let n = 10_u32;
for i in 0..n {
let claimer = H160::from_low_u64_be(i as u64);
create_token_uri_extension(
claimer.clone(),
universal_location.clone(),
token_uri.clone(),
);
create_token_uri_extension(claimer, universal_location.clone(), token_uri.clone());
}

for i in 0..n {
Expand All @@ -325,7 +321,7 @@ fn token_uri_extension_by_index_works() {
for i in 0..n {
let claimer = H160::from_low_u64_be(i as u64);
create_token_uri_extension(
claimer.clone(),
claimer,
universal_location.clone(),
token_uri_expected.clone(),
);
Expand All @@ -348,7 +344,7 @@ fn get_unexistent_extension_by_location_and_claimer_fails() {
assert_eq!(
AssetMetadataExtender::extension_by_location_and_claimer(
universal_location.clone(),
claimer.clone()
claimer
),
None
);
Expand All @@ -362,11 +358,11 @@ fn get_extension_by_location_and_claimer_works() {
let universal_location: UniversalLocationOf<Test> = bounded_vec![1; 10];
let token_uri: TokenUriOf<Test> = bounded_vec![2; 10];

create_token_uri_extension(claimer.clone(), universal_location.clone(), token_uri.clone());
create_token_uri_extension(claimer, universal_location.clone(), token_uri.clone());
assert_eq!(
AssetMetadataExtender::extension_by_location_and_claimer(
universal_location.clone(),
claimer.clone()
claimer
)
.unwrap(),
token_uri
Expand All @@ -381,7 +377,7 @@ fn has_extension_should_return_true_if_it_exists() {
let universal_location: UniversalLocationOf<Test> = bounded_vec![1; 10];
let token_uri: TokenUriOf<Test> = bounded_vec![2; 10];

create_token_uri_extension(claimer.clone(), universal_location.clone(), token_uri.clone());
create_token_uri_extension(claimer, universal_location.clone(), token_uri.clone());
assert!(AssetMetadataExtender::has_extension(universal_location, claimer));
});
}
Expand All @@ -392,6 +388,6 @@ fn has_extension_should_return_false_if_it_does_not_exist() {
let claimer = H160::zero();
let universal_location: UniversalLocationOf<Test> = bounded_vec![1; 10];

assert_eq!(AssetMetadataExtender::has_extension(universal_location, claimer), false);
assert!(!AssetMetadataExtender::has_extension(universal_location, claimer));
});
}
2 changes: 1 addition & 1 deletion pallets/laos-evolution/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ mod benchmarks {
let caller: T::AccountId = whitelisted_caller();
let owner = caller.clone();
let collection_id = LaosEvolution::<T>::create_collection(owner.clone()).unwrap();
let _ = LaosEvolution::<T>::enable_public_minting(owner.clone(), collection_id).unwrap();
LaosEvolution::<T>::enable_public_minting(owner.clone(), collection_id).unwrap();

#[block]
{
Expand Down
8 changes: 4 additions & 4 deletions pallets/laos-evolution/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ fn disable_public_minting_for_nonexistent_collection_fails() {
#[test]
fn is_public_minting_enabled_for_nonexistent_returns_false() {
new_test_ext().execute_with(|| {
assert_eq!(LaosEvolution::is_public_minting_enabled(0), false);
assert!(!LaosEvolution::is_public_minting_enabled(0));
});
}

Expand All @@ -556,11 +556,11 @@ fn is_public_minting_enabled_returns_updated_value() {
new_test_ext().execute_with(|| {
let collection_id = create_collection(ALICE);
let who = AccountId::from_str(ALICE).unwrap();
assert_eq!(LaosEvolution::is_public_minting_enabled(collection_id), false);
assert!(!LaosEvolution::is_public_minting_enabled(collection_id));
assert_ok!(LaosEvolution::enable_public_minting(who, collection_id));
assert_eq!(LaosEvolution::is_public_minting_enabled(collection_id), true);
assert!(LaosEvolution::is_public_minting_enabled(collection_id));
assert_ok!(LaosEvolution::disable_public_minting(who, collection_id));
assert_eq!(LaosEvolution::is_public_minting_enabled(collection_id), false);
assert!(!LaosEvolution::is_public_minting_enabled(collection_id));
});
}

Expand Down
Loading
Loading