Skip to content

Commit

Permalink
Remove workspace lints from templates (#4598)
Browse files Browse the repository at this point in the history
This detaches the templates from monorepo's workspace lints, so the
lints for the templates can evolve separately as needed.

Currently the templates [re-use the monorepo's
lints](https://github.com/paritytech/polkadot-sdk-minimal-template/blob/bd8afe66ec566d61f36b0e3d731145741a9e9e19/Cargo.toml#L16-L43)
which looks weird.

cc @kianenigma @gupnik
  • Loading branch information
rzadp authored May 28, 2024
1 parent 2d3a693 commit 09f07d5
Show file tree
Hide file tree
Showing 19 changed files with 11 additions and 43 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/misc-sync-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ jobs:
toml set templates/${{ matrix.template }}/Cargo.toml 'workspace.package.edition' "$(toml get --raw Cargo.toml 'workspace.package.edition')" > Cargo.temp
mv Cargo.temp ./templates/${{ matrix.template }}/Cargo.toml
toml get Cargo.toml 'workspace.lints' --output-toml >> ./templates/${{ matrix.template }}/Cargo.toml
toml get Cargo.toml 'workspace.dependencies' --output-toml >> ./templates/${{ matrix.template }}/Cargo.toml
working-directory: polkadot-sdk
- name: Print the result Cargo.tomls for debugging
Expand Down
3 changes: 0 additions & 3 deletions templates/minimal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ repository.workspace = true
edition.workspace = true
publish = false

[lints]
workspace = true

[dependencies]
minimal-template-node = { path = "./node" }
minimal-template-runtime = { path = "./runtime" }
Expand Down
3 changes: 0 additions & 3 deletions templates/minimal/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ edition.workspace = true
publish = false
build = "build.rs"

[lints]
workspace = true

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

Expand Down
2 changes: 1 addition & 1 deletion templates/minimal/node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl std::str::FromStr for Consensus {
} else if let Some(block_time) = s.strip_prefix("manual-seal-") {
Consensus::ManualSeal(block_time.parse().map_err(|_| "invalid block time")?)
} else {
return Err("incorrect consensus identifier".into())
return Err("incorrect consensus identifier".into());
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion templates/minimal/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub fn new_partial(config: &Configuration) -> Result<Service, ServiceError> {
})
.transpose()?;

let executor = sc_service::new_wasm_executor(&config);
let executor = sc_service::new_wasm_executor(config);

let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, _>(
Expand Down
3 changes: 0 additions & 3 deletions templates/minimal/pallets/template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ repository.workspace = true
edition.workspace = true
publish = false

[lints]
workspace = true

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

Expand Down
3 changes: 0 additions & 3 deletions templates/minimal/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ repository.workspace = true
edition.workspace = true
publish = false

[lints]
workspace = true

[dependencies]
parity-scale-codec = { version = "3.6.12", default-features = false }
scale-info = { version = "2.6.0", default-features = false }
Expand Down
3 changes: 0 additions & 3 deletions templates/parachain/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ edition.workspace = true
publish = false
build = "build.rs"

[lints]
workspace = true

# [[bin]]
# name = "parachain-template-node"

Expand Down
1 change: 1 addition & 0 deletions templates/parachain/node/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::path::PathBuf;

/// Sub-commands supported by the collator.
#[allow(clippy::large_enum_variant)]
#[derive(Debug, clap::Subcommand)]
pub enum Subcommand {
/// Build a chain specification.
Expand Down
10 changes: 4 additions & 6 deletions templates/parachain/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,11 @@ pub fn run() -> Result<()> {
cmd.run(partials.client)
}),
#[cfg(not(feature = "runtime-benchmarks"))]
BenchmarkCmd::Storage(_) =>
return Err(sc_cli::Error::Input(
"Compile with --features=runtime-benchmarks \
BenchmarkCmd::Storage(_) => Err(sc_cli::Error::Input(
"Compile with --features=runtime-benchmarks \
to enable storage benchmarks."
.into(),
)
.into()),
.into(),
)),
#[cfg(feature = "runtime-benchmarks")]
BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| {
let partials = new_partial(&config)?;
Expand Down
1 change: 1 addition & 0 deletions templates/parachain/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ fn build_import_queue(
)
}

#[allow(clippy::too_many_arguments)]
fn start_consensus(
client: Arc<ParachainClient>,
backend: Arc<ParachainBackend>,
Expand Down
3 changes: 0 additions & 3 deletions templates/parachain/pallets/template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ repository.workspace = true
edition.workspace = true
publish = false

[lints]
workspace = true

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

Expand Down
2 changes: 1 addition & 1 deletion templates/parachain/pallets/template/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mod benchmarks {

#[benchmark]
fn do_something() {
let value = 100u32.into();
let value = 100u32;
let caller: T::AccountId = whitelisted_caller();
#[extrinsic_call]
do_something(RawOrigin::Signed(caller), value);
Expand Down
3 changes: 0 additions & 3 deletions templates/parachain/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ repository.workspace = true
edition.workspace = true
publish = false

[lints]
workspace = true

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

Expand Down
3 changes: 0 additions & 3 deletions templates/solochain/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ publish = false

build = "build.rs"

[lints]
workspace = true

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

Expand Down
2 changes: 1 addition & 1 deletion templates/solochain/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ pub fn run() -> sc_cli::Result<()> {
"Runtime benchmarking wasn't enabled when building the node. \
You can enable it with `--features runtime-benchmarks`."
.into(),
)
);
}

cmd.run_with_spec::<sp_runtime::traits::HashingFor<Block>, ()>(Some(
Expand Down
3 changes: 0 additions & 3 deletions templates/solochain/pallets/template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ repository.workspace = true
edition.workspace = true
publish = false

[lints]
workspace = true

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

Expand Down
2 changes: 1 addition & 1 deletion templates/solochain/pallets/template/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mod benchmarks {

#[benchmark]
fn do_something() {
let value = 100u32.into();
let value = 100u32;
let caller: T::AccountId = whitelisted_caller();
#[extrinsic_call]
do_something(RawOrigin::Signed(caller), value);
Expand Down
3 changes: 0 additions & 3 deletions templates/solochain/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ repository.workspace = true
edition.workspace = true
publish = false

[lints]
workspace = true

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

Expand Down

0 comments on commit 09f07d5

Please sign in to comment.