Skip to content

Commit c41cfeb

Browse files
authored
fmt: wrap comments. (#237)
* fmt: wrap comments. * Github actions: use nightly toolchain. * Make file: does not enforce stable fmt.
1 parent a42b1b2 commit c41cfeb

File tree

17 files changed

+273
-196
lines changed

17 files changed

+273
-196
lines changed

.github/workflows/master.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
uses: actions-rs/toolchain@v1
2323
with:
2424
profile: minimal
25-
toolchain: stable
25+
toolchain: nightly
2626
override: true
2727
default: true
2828
- name: Install cargo-unleash

.github/workflows/publish_packages.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- uses: actions/checkout@v2
2727
- uses: actions-rs/toolchain@v1
2828
with:
29-
toolchain: stable
29+
toolchain: nightly
3030
override: true
3131
- run: rustup component add rustfmt
3232
- run: make Cargo.toml

.rustfmt.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
reorder_imports = true
22
hard_tabs = true
3-
max_width = 120
3+
max_width = 120
4+
wrap_comments = true

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ githooks: $(GITHOOK) $(GITHOOKS_DEST)
2323
init: githooks
2424

2525
format:
26-
./scripts/run.sh "+stable fmt"
26+
./scripts/run.sh "fmt"
2727

2828

2929
# Standalone development workflow targets
@@ -33,10 +33,10 @@ Cargo.toml: Cargo.dev.toml
3333
cp Cargo.dev.toml Cargo.toml
3434

3535
dev-format: Cargo.toml
36-
cargo +stable fmt --all
36+
cargo fmt --all
3737

3838
dev-format-check: Cargo.toml
39-
cargo +stable fmt --all -- --check
39+
cargo fmt --all -- --check
4040

4141
# needs to use run.sh to check individual projects because
4242
# --no-default-features is not allowed in the root of a virtual workspace

auction/src/lib.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
//!
33
//! ## Overview
44
//!
5-
//! This module provides a basic abstraction to implement on-chain auctioning feature.
5+
//! This module provides a basic abstraction to implement on-chain auctioning
6+
//! feature.
67
//!
7-
//! The auction logic can be customized by implement and supplying `AuctionHandler` trait.
8+
//! The auction logic can be customized by implement and supplying
9+
//! `AuctionHandler` trait.
810
911
#![cfg_attr(not(feature = "std"), no_std)]
1012
// Disable the following two lints since they originate from an external macro (namely decl_storage)
@@ -34,7 +36,8 @@ pub trait Trait: frame_system::Trait {
3436
/// The auction ID type
3537
type AuctionId: Parameter + Member + AtLeast32Bit + Default + Copy + MaybeSerializeDeserialize + Bounded;
3638

37-
/// The `AuctionHandler` that allow custom bidding logic and handles auction result
39+
/// The `AuctionHandler` that allow custom bidding logic and handles auction
40+
/// result
3841
type Handler: AuctionHandler<Self::AccountId, Self::Balance, Self::BlockNumber, Self::AuctionId>;
3942
}
4043

benchmarking/src/lib.rs

+43-35
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//! Macro for benchmarking a Substrate runtime. A fork of `frame-benchmarking` pallet.
1+
//! Macro for benchmarking a Substrate runtime. A fork of `frame-benchmarking`
2+
//! pallet.
23
34
#![cfg_attr(not(feature = "std"), no_std)]
45

@@ -19,13 +20,15 @@ pub use sp_runtime::traits::{Dispatchable, One, Zero};
1920

2021
/// Construct pallet benchmarks for weighing dispatchables.
2122
///
22-
/// Works around the idea of complexity parameters, named by a single letter (which is usually
23-
/// upper cased in complexity notation but is lower-cased for use in this macro).
23+
/// Works around the idea of complexity parameters, named by a single letter
24+
/// (which is usually upper cased in complexity notation but is lower-cased for
25+
/// use in this macro).
2426
///
25-
/// Complexity parameters ("parameters") have a range which is a `u32` pair. Every time a benchmark
26-
/// is prepared and run, this parameter takes a concrete value within the range. There is an
27-
/// associated instancing block, which is a single expression that is evaluated during
28-
/// preparation. It may use `?` (`i.e. `return Err(...)`) to bail with a string error. Here's a
27+
/// Complexity parameters ("parameters") have a range which is a `u32` pair.
28+
/// Every time a benchmark is prepared and run, this parameter takes a concrete
29+
/// value within the range. There is an associated instancing block, which is a
30+
/// single expression that is evaluated during preparation. It may use `?`
31+
/// (`i.e. `return Err(...)`) to bail with a string error. Here's a
2932
/// few examples:
3033
///
3134
/// ```ignore
@@ -42,29 +45,32 @@ pub use sp_runtime::traits::{Dispatchable, One, Zero};
4245
/// }
4346
/// ```
4447
///
45-
/// Note that due to parsing restrictions, if the `from` expression is not a single token (i.e. a
46-
/// literal or constant), then it must be parenthesised.
48+
/// Note that due to parsing restrictions, if the `from` expression is not a
49+
/// single token (i.e. a literal or constant), then it must be parenthesised.
4750
///
48-
/// The macro allows for a number of "arms", each representing an individual benchmark. Using the
49-
/// simple syntax, the associated dispatchable function maps 1:1 with the benchmark and the name of
50-
/// the benchmark is the same as that of the associated function. However, extended syntax allows
51-
/// for arbitrary expresions to be evaluated in a benchmark (including for example,
52-
/// `on_initialize`).
51+
/// The macro allows for a number of "arms", each representing an individual
52+
/// benchmark. Using the simple syntax, the associated dispatchable function
53+
/// maps 1:1 with the benchmark and the name of the benchmark is the same as
54+
/// that of the associated function. However, extended syntax allows
55+
/// for arbitrary expresions to be evaluated in a benchmark (including for
56+
/// example, `on_initialize`).
5357
///
54-
/// The macro allows for common parameters whose ranges and instancing expressions may be drawn upon
55-
/// (or not) by each arm. Syntax is available to allow for only the range to be drawn upon if
56-
/// desired, allowing an alternative instancing expression to be given.
58+
/// The macro allows for common parameters whose ranges and instancing
59+
/// expressions may be drawn upon (or not) by each arm. Syntax is available to
60+
/// allow for only the range to be drawn upon if desired, allowing an
61+
/// alternative instancing expression to be given.
5762
///
58-
/// Note that the ranges are *inclusive* on both sides. This is in contrast to ranges in Rust which
59-
/// are left-inclusive right-exclusive.
63+
/// Note that the ranges are *inclusive* on both sides. This is in contrast to
64+
/// ranges in Rust which are left-inclusive right-exclusive.
6065
///
61-
/// Each arm may also have a block of code which is run prior to any instancing and a block of code
62-
/// which is run afterwards. All code blocks may draw upon the specific value of each parameter
63-
/// at any time. Local variables are shared between the two pre- and post- code blocks, but do not
64-
/// leak from the interior of any instancing expressions.
66+
/// Each arm may also have a block of code which is run prior to any instancing
67+
/// and a block of code which is run afterwards. All code blocks may draw upon
68+
/// the specific value of each parameter at any time. Local variables are shared
69+
/// between the two pre- and post- code blocks, but do not leak from the
70+
/// interior of any instancing expressions.
6571
///
66-
/// Any common parameters that are unused in an arm do not have their instancing expressions
67-
/// evaluated.
72+
/// Any common parameters that are unused in an arm do not have their instancing
73+
/// expressions evaluated.
6874
///
6975
/// Example:
7076
/// ```ignore
@@ -124,14 +130,16 @@ pub use sp_runtime::traits::{Dispatchable, One, Zero};
124130
/// }
125131
/// ```
126132
///
127-
/// Test functions are automatically generated for each benchmark and are accessible to you when you
128-
/// run `cargo test`. All tests are named `test_benchmark_<benchmark_name>`, expect you to pass them
129-
/// the Runtime Trait, and run them in a test externalities environment. The test function runs your
130-
/// benchmark just like a regular benchmark, but only testing at the lowest and highest values for
131-
/// each component. The function will return `Ok(())` if the benchmarks return no errors.
133+
/// Test functions are automatically generated for each benchmark and are
134+
/// accessible to you when you run `cargo test`. All tests are named
135+
/// `test_benchmark_<benchmark_name>`, expect you to pass them the Runtime
136+
/// Trait, and run them in a test externalities environment. The test function
137+
/// runs your benchmark just like a regular benchmark, but only testing at the
138+
/// lowest and highest values for each component. The function will return
139+
/// `Ok(())` if the benchmarks return no errors.
132140
///
133-
/// You can optionally add a `verify` code block at the end of a benchmark to test any final state
134-
/// of your benchmark in a unit test. For example:
141+
/// You can optionally add a `verify` code block at the end of a benchmark to
142+
/// test any final state of your benchmark in a unit test. For example:
135143
///
136144
/// ```ignore
137145
/// sort_vector {
@@ -648,7 +656,7 @@ macro_rules! benchmark_backend {
648656
// Every variant must implement [`BenchmarkingSetup`].
649657
//
650658
// ```nocompile
651-
//
659+
//
652660
// struct Transfer;
653661
// impl BenchmarkingSetup for Transfer { ... }
654662
//
@@ -1142,8 +1150,8 @@ macro_rules! impl_benchmark_test {
11421150
/// let mut batches = Vec::<BenchmarkBatch>::new();
11431151
/// ````
11441152
///
1145-
/// Then add the pallets you want to benchmark to this object, including the string
1146-
/// you want to use target a particular pallet:
1153+
/// Then add the pallets you want to benchmark to this object, including the
1154+
/// string you want to use target a particular pallet:
11471155
///
11481156
/// ```ignore
11491157
/// add_benchmark!(params, batches, b"balances", Balances);

benchmarking/src/tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ impl Trait for Test {
8888
type AccountId = u128;
8989
}
9090

91-
// This function basically just builds a genesis storage key/value store according to
92-
// our desired mockup.
91+
// This function basically just builds a genesis storage key/value store
92+
// according to our desired mockup.
9393
fn new_test_ext() -> sp_io::TestExternalities {
9494
frame_system::GenesisConfig::default()
9595
.build_storage::<Test>()

currencies/src/lib.rs

+21-14
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,39 @@
22
//!
33
//! ## Overview
44
//!
5-
//! The currencies module provides a mixed currencies system, by configuring a native currency which implements
6-
//! `BasicCurrencyExtended`, and a multi-currency which implements `MultiCurrency`.
5+
//! The currencies module provides a mixed currencies system, by configuring a
6+
//! native currency which implements `BasicCurrencyExtended`, and a
7+
//! multi-currency which implements `MultiCurrency`.
78
//!
8-
//! It also provides an adapter, to adapt `frame_support::traits::Currency` implementations into
9-
//! `BasicCurrencyExtended`.
9+
//! It also provides an adapter, to adapt `frame_support::traits::Currency`
10+
//! implementations into `BasicCurrencyExtended`.
1011
//!
11-
//! The currencies module provides functionality of both `MultiCurrencyExtended` and `BasicCurrencyExtended`, via
12-
//! unified interfaces, and all calls would be delegated to the underlying multi-currency and base currency system.
13-
//! A native currency ID could be set by `Trait::GetNativeCurrencyId`, to identify the native currency.
12+
//! The currencies module provides functionality of both `MultiCurrencyExtended`
13+
//! and `BasicCurrencyExtended`, via unified interfaces, and all calls would be
14+
//! delegated to the underlying multi-currency and base currency system.
15+
//! A native currency ID could be set by `Trait::GetNativeCurrencyId`, to
16+
//! identify the native currency.
1417
//!
1518
//! ### Implementations
1619
//!
1720
//! The currencies module provides implementations for following traits.
1821
//!
1922
//! - `MultiCurrency` - Abstraction over a fungible multi-currency system.
20-
//! - `MultiCurrencyExtended` - Extended `MultiCurrency` with additional helper types and methods, like updating balance
23+
//! - `MultiCurrencyExtended` - Extended `MultiCurrency` with additional helper
24+
//! types and methods, like updating balance
2125
//! by a given signed integer amount.
2226
//!
2327
//! ## Interface
2428
//!
2529
//! ### Dispatchable Functions
2630
//!
27-
//! - `transfer` - Transfer some balance to another account, in a given currency.
28-
//! - `transfer_native_currency` - Transfer some balance to another account, in native currency set in
31+
//! - `transfer` - Transfer some balance to another account, in a given
32+
//! currency.
33+
//! - `transfer_native_currency` - Transfer some balance to another account, in
34+
//! native currency set in
2935
//! `Trait::NativeCurrency`.
30-
//! - `update_balance` - Update balance by signed integer amount, in a given currency, root origin required.
36+
//! - `update_balance` - Update balance by signed integer amount, in a given
37+
//! currency, root origin required.
3138
3239
#![cfg_attr(not(feature = "std"), no_std)]
3340

@@ -49,9 +56,9 @@ use sp_std::{
4956
fmt::Debug,
5057
marker, result,
5158
};
52-
// FIXME: `pallet/frame-` prefix should be used for all pallet modules, but currently `frame_system`
53-
// would cause compiling error in `decl_module!` and `construct_runtime!`
54-
// #3295 https://github.com/paritytech/substrate/issues/3295
59+
// FIXME: `pallet/frame-` prefix should be used for all pallet modules, but
60+
// currently `frame_system` would cause compiling error in `decl_module!` and
61+
// `construct_runtime!` #3295 https://github.com/paritytech/substrate/issues/3295
5562
use frame_system::{self as system, ensure_root, ensure_signed};
5663

5764
use orml_traits::{

gradually-update/src/lib.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
//!
88
//! ## Overview
99
//!
10-
//! This module exposes capabilities for scheduling updates to storage values gradually.
11-
//! This is useful to change parameter values gradually to ensure a smooth transition.
12-
//! It is also possible to cancel an update before it reaches to target value.
10+
//! This module exposes capabilities for scheduling updates to storage values
11+
//! gradually. This is useful to change parameter values gradually to ensure a
12+
//! smooth transition. It is also possible to cancel an update before it reaches
13+
//! to target value.
1314
//!
14-
//! NOTE: Only unsigned integer value up to 128 bits are supported. But a "newtype" pattern struct
15-
//! that wraps an unsigned integer works too such as `Permill` and `FixedU128`.
15+
//! NOTE: Only unsigned integer value up to 128 bits are supported. But a
16+
//! "newtype" pattern struct that wraps an unsigned integer works too such as
17+
//! `Permill` and `FixedU128`.
1618
1719
#![cfg_attr(not(feature = "std"), no_std)]
1820
// Disable the following two lints since they originate from an external macro (namely decl_storage)

oracle/src/lib.rs

+11-8
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
//!
88
//! ## Overview
99
//!
10-
//! This module exposes capabilities for oracle operators to feed external offchain data.
11-
//! The raw values can be combined to provide an aggregated value.
10+
//! This module exposes capabilities for oracle operators to feed external
11+
//! offchain data. The raw values can be combined to provide an aggregated
12+
//! value.
1213
//!
13-
//! The data are submitted with unsigned transaction so it does not incure a transaction fee. However the data
14-
//! still needs to be signed by a session key to prevent spam and ensure the integrity.
14+
//! The data are submitted with unsigned transaction so it does not incure a
15+
//! transaction fee. However the data still needs to be signed by a session key
16+
//! to prevent spam and ensure the integrity.
1517
1618
#![cfg_attr(not(feature = "std"), no_std)]
1719
// Disable the following two lints since they originate from an external macro (namely decl_storage)
@@ -39,9 +41,9 @@ use sp_runtime::{
3941
DispatchResult, RuntimeDebug,
4042
};
4143
use sp_std::{convert::TryInto, prelude::*, vec};
42-
// FIXME: `pallet/frame-` prefix should be used for all pallet modules, but currently `frame_system`
43-
// would cause compiling error in `decl_module!` and `construct_runtime!`
44-
// #3295 https://github.com/paritytech/substrate/issues/3295
44+
// FIXME: `pallet/frame-` prefix should be used for all pallet modules, but
45+
// currently `frame_system` would cause compiling error in `decl_module!` and
46+
// `construct_runtime!` #3295 https://github.com/paritytech/substrate/issues/3295
4547
use frame_system::{self as system, ensure_none, ensure_root, ensure_signed};
4648
pub use orml_traits::{CombineData, DataProvider, DataProviderExtended, OnNewData};
4749
use orml_utilities::OrderedSet;
@@ -84,7 +86,8 @@ pub trait Trait: frame_system::Trait {
8486
/// Hook on new data received
8587
type OnNewData: OnNewData<Self::AccountId, Self::OracleKey, Self::OracleValue>;
8688

87-
/// Provide the implementation to combine raw values to produce aggregated value
89+
/// Provide the implementation to combine raw values to produce aggregated
90+
/// value
8891
type CombineData: CombineData<Self::OracleKey, TimestampedValueOf<Self>>;
8992

9093
/// Time provider

oracle/src/mock.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ impl Trait for Test {
100100
type AuthorityId = UintAuthorityId;
101101
}
102102
pub type ModuleOracle = Module<Test>;
103-
// This function basically just builds a genesis storage key/value store according to
104-
// our desired mockup.
103+
// This function basically just builds a genesis storage key/value store
104+
// according to our desired mockup.
105105
pub fn new_test_ext() -> sp_io::TestExternalities {
106106
let mut storage = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
107107

0 commit comments

Comments
 (0)