Skip to content

Commit

Permalink
add substrate fmt config
Browse files Browse the repository at this point in the history
  • Loading branch information
clangenb committed Feb 29, 2024
1 parent 67c9206 commit 4282d74
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 22 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/check-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ jobs:
continue-on-error: false
steps:
- uses: actions/checkout@v4
- run: cargo fmt --all -- --check
# some settings are only available in nightly.
- run: cargo +nightly fmt --all -- --check

lint:
if: ${{ !startsWith(github.head_ref, 'release/') }}
Expand Down
25 changes: 12 additions & 13 deletions runtime/bajun/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,17 @@ use sp_std::prelude::*;
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;

use frame_support::pallet_prelude::ConstU32;
use frame_support::traits::fungible::HoldConsideration;
use frame_support::traits::tokens::{PayFromAccount, UnityAssetBalanceConversion};
use frame_support::traits::{LinearStoragePrice, TransformOrigin};
use frame_support::{
construct_runtime,
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
pallet_prelude::ConstU32,
parameter_types,
traits::{AsEnsureOriginWithArg, ConstBool, Contains},
traits::{
fungible::HoldConsideration,
tokens::{PayFromAccount, UnityAssetBalanceConversion},
AsEnsureOriginWithArg, ConstBool, Contains, LinearStoragePrice, TransformOrigin,
},
weights::{
constants::WEIGHT_REF_TIME_PER_SECOND, ConstantMultiplier, Weight, WeightToFeeCoefficient,
WeightToFeeCoefficients, WeightToFeePolynomial,
Expand Down Expand Up @@ -83,8 +84,10 @@ use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
use staging_xcm::latest::prelude::BodyId;

use pallet_nfts::{AttributeNamespace, Call as NftsCall};
use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling};
use parachains_common::{BlockNumber, Hash, Header};
use parachains_common::{
message_queue::{NarrowOriginToSibling, ParaIdToSibling},
BlockNumber, Hash, Header,
};
use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery;
use sp_runtime::traits::{IdentifyAccount, IdentityLookup, Verify};

Expand Down Expand Up @@ -334,14 +337,10 @@ impl Contains<RuntimeCall> for BaseCallFilter {
match call {
RuntimeCall::Nft(NftsCall::set_attribute { namespace, .. })
if namespace == &AttributeNamespace::CollectionOwner =>
{
true
},
true,
RuntimeCall::Nft(NftsCall::set_attribute { namespace, .. })
if namespace != &AttributeNamespace::CollectionOwner =>
{
false
},
false,
_ => true,
}
}
Expand Down
4 changes: 2 additions & 2 deletions runtime/bajun/src/proxy_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
},
ProxyType::IdentityJudgement => matches!(
c,
RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. })
| RuntimeCall::Utility(..)
RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. }) |
RuntimeCall::Utility(..)
),
ProxyType::CancelProxy => {
matches!(c, RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. }))
Expand Down
22 changes: 16 additions & 6 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
# Basic
hard_tabs = true
max_width = 100
edition = "2021"
hard_tabs = true
max_width = 100
use_small_heuristics = "Max"
# Imports
imports_granularity = "Crate"
reorder_imports = true
reorder_modules = true
# Consistency
newline_style = "Unix"
# Misc
chain_width = 80
match_arm_leading_pipes = "Preserve"
chain_width = 80
spaces_around_ranges = false
binop_separator = "Back"
reorder_impl_items = false
match_arm_leading_pipes = "Preserve"
match_arm_blocks = false
match_block_trailing_comma = true
use_field_init_shorthand = true
trailing_comma = "Vertical"
trailing_semicolon = false
use_field_init_shorthand = true
# Format comments
comment_width = 100
wrap_comments = true

0 comments on commit 4282d74

Please sign in to comment.