diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 724456e..7f95086 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,6 +7,7 @@
stages:
- fmt
+ - clippy
- build-linux
- build-mac
- publish
@@ -76,15 +77,18 @@ workflow:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
-### stage: fmt
-
fmt:
stage: fmt
<<: *docker-env
script:
- cargo +nightly fmt --verbose --all -- --check
-### stage: build-linux
+clippy:
+ stage: clippy
+ <<: *docker-env
+ script:
+ # TODO: Add `--all-features` flag once #86 is merged
+ - cargo +nightly clippy --verbose --all-targets -- -D warnings
build-linux:
stage: build-linux
@@ -97,8 +101,6 @@ build-linux:
- mkdir -p ./artifacts/canvas-linux/
- cp ${CARGO_TARGET_DIR}/release/canvas ./artifacts/canvas-linux/canvas
-### stage: build-mac
-
build-mac:
stage: build-mac
<<: *docker-env
diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs
index 3f2e300..8a08c28 100644
--- a/node/src/chain_spec.rs
+++ b/node/src/chain_spec.rs
@@ -289,7 +289,7 @@ fn canvas_genesis(
.map(|(acc, aura)| {
(
acc.clone(), // account id
- acc.clone(), // validator id
+ acc, // validator id
canvas_session_keys(aura), // session keys
)
})
diff --git a/node/src/cli.rs b/node/src/cli.rs
index 9b9d318..25bcca6 100644
--- a/node/src/cli.rs
+++ b/node/src/cli.rs
@@ -15,8 +15,6 @@
// along with this program. If not, see .
use crate::chain_spec;
-use cumulus_client_cli;
-use sc_cli;
use std::path::PathBuf;
use structopt::StructOpt;
diff --git a/node/src/command.rs b/node/src/command.rs
index a9c16f1..24c0764 100644
--- a/node/src/command.rs
+++ b/node/src/command.rs
@@ -116,8 +116,7 @@ impl SubstrateCli for RelayChainCli {
}
fn load_spec(&self, id: &str) -> std::result::Result, String> {
- polkadot_cli::Cli::from_iter([RelayChainCli::executable_name().to_string()].iter())
- .load_spec(id)
+ polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id)
}
fn native_runtime_version(chain_spec: &Box) -> &'static RuntimeVersion {
@@ -125,6 +124,7 @@ impl SubstrateCli for RelayChainCli {
}
}
+#[allow(clippy::borrowed_box)]
fn extract_genesis_wasm(chain_spec: &Box) -> Result> {
let mut storage = chain_spec.build_storage()?;
@@ -187,9 +187,7 @@ pub fn run() -> Result<()> {
runner.sync_run(|config| {
let polkadot_cli = RelayChainCli::new(
&config,
- [RelayChainCli::executable_name().to_string()]
- .iter()
- .chain(cli.relaychain_args.iter()),
+ [RelayChainCli::executable_name()].iter().chain(cli.relaychain_args.iter()),
);
let polkadot_config = SubstrateCli::create_configuration(
@@ -271,9 +269,7 @@ pub fn run() -> Result<()> {
let polkadot_cli = RelayChainCli::new(
&config,
- [RelayChainCli::executable_name().to_string()]
- .iter()
- .chain(cli.relaychain_args.iter()),
+ [RelayChainCli::executable_name()].iter().chain(cli.relaychain_args.iter()),
);
let id = ParaId::from(cli.run.parachain_id.or(para_id).unwrap_or(1002));
diff --git a/node/src/rpc.rs b/node/src/rpc.rs
index 7054fd2..6c13af7 100644
--- a/node/src/rpc.rs
+++ b/node/src/rpc.rs
@@ -70,7 +70,7 @@ where
io.extend_with(SystemApi::to_delegate(FullSystem::new(client.clone(), pool, deny_unsafe)));
io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new(client.clone())));
- io.extend_with(ContractsApi::to_delegate(Contracts::new(client.clone())));
+ io.extend_with(ContractsApi::to_delegate(Contracts::new(client)));
io
}
diff --git a/node/src/service.rs b/node/src/service.rs
index 5d85055..35561c1 100644
--- a/node/src/service.rs
+++ b/node/src/service.rs
@@ -66,6 +66,7 @@ impl sc_executor::NativeExecutionDispatch for CanvasRuntimeExecutor {
///
/// Use this macro if you don't actually need the full service, but just the builder in order to
/// be able to perform chain operations.
+#[allow(clippy::type_complexity)]
pub fn new_partial(
config: &Configuration,
build_import_queue: BIQ,
@@ -133,7 +134,7 @@ where
let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::(
- &config,
+ config,
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
executor,
)?;
@@ -367,6 +368,7 @@ where
}
/// Build the import queue for the parachain runtime.
+#[allow(clippy::type_complexity)]
pub fn parachain_build_import_queue(
client: Arc>>,
config: &Configuration,
@@ -403,7 +405,7 @@ pub fn parachain_build_import_queue(
Ok((time, slot))
},
- registry: config.prometheus_registry().clone(),
+ registry: config.prometheus_registry(),
can_author_with: sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()),
spawner: &task_manager.spawn_essential_handle(),
telemetry,
@@ -441,7 +443,7 @@ pub async fn start_parachain_node(
task_manager.spawn_handle(),
client.clone(),
transaction_pool,
- prometheus_registry.clone(),
+ prometheus_registry,
telemetry.clone(),
);
@@ -489,7 +491,7 @@ pub async fn start_parachain_node(
block_import: client.clone(),
relay_chain_client: relay_chain_node.client.clone(),
relay_chain_backend: relay_chain_node.backend.clone(),
- para_client: client.clone(),
+ para_client: client,
backoff_authoring_blocks: Option::<()>::None,
sync_oracle,
keystore,
diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs
index 750b4c1..aa5da68 100644
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -232,11 +232,11 @@ pub const MILLIUNIT: Balance = 1_000_000_000;
pub const MICROUNIT: Balance = 1_000_000;
/// The existential deposit. Set to 1/10 of the Rococo Relay Chain.
-pub const EXISTENTIAL_DEPOSIT: Balance = 1 * MILLIUNIT;
+pub const EXISTENTIAL_DEPOSIT: Balance = MILLIUNIT;
const fn deposit(items: u32, bytes: u32) -> Balance {
// This is a 1/10 of the deposit on the Rococo Relay Chain
- (items as Balance * 1 * UNIT + (bytes as Balance) * (5 * MILLIUNIT / 100)) / 10
+ (items as Balance * UNIT + (bytes as Balance) * (5 * MILLIUNIT / 100)) / 10
}
// 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks.
@@ -924,7 +924,7 @@ impl cumulus_pallet_parachain_system::CheckInherents for CheckInherents {
.create_inherent_data()
.expect("Could not create the timestamp inherent data");
- inherent_data.check_extrinsics(&block)
+ inherent_data.check_extrinsics(block)
}
}