Skip to content

Commit 88ffd67

Browse files
committed
Apply cargo fmt
1 parent 03c6455 commit 88ffd67

File tree

7 files changed

+65
-29
lines changed

7 files changed

+65
-29
lines changed

crates/env/src/call/create_builder.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,13 @@ where
392392
/// .code_hash(ink::H256::from([0x42; 32]))
393393
/// .endowment(25.into())
394394
/// .exec_input(
395-
/// ExecutionInput::new(Selector::new(ink::selector_bytes!(Abi::Ink, "my_constructor")))
396-
/// .push_arg(42)
397-
/// .push_arg(true)
398-
/// .push_arg(&[0x10u8; 32]),
395+
/// ExecutionInput::new(Selector::new(ink::selector_bytes!(
396+
/// Abi::Ink,
397+
/// "my_constructor"
398+
/// )))
399+
/// .push_arg(42)
400+
/// .push_arg(true)
401+
/// .push_arg(&[0x10u8; 32]),
399402
/// )
400403
/// .salt_bytes(Some([1u8; 32]))
401404
/// .returns::<MyContractRef>()
@@ -436,10 +439,13 @@ where
436439
/// .code_hash(ink::H256::from([0x42; 32]))
437440
/// .endowment(25.into())
438441
/// .exec_input(
439-
/// ExecutionInput::new(Selector::new(ink::selector_bytes!(Abi::Ink, "my_constructor")))
440-
/// .push_arg(42)
441-
/// .push_arg(true)
442-
/// .push_arg(&[0x10u8; 32]),
442+
/// ExecutionInput::new(Selector::new(ink::selector_bytes!(
443+
/// Abi::Ink,
444+
/// "my_constructor"
445+
/// )))
446+
/// .push_arg(42)
447+
/// .push_arg(true)
448+
/// .push_arg(&[0x10u8; 32]),
443449
/// )
444450
/// .salt_bytes(Some([1u8; 32]))
445451
/// .returns::<Result<MyContractRef, ConstructorError>>()

crates/ink/ir/src/ir/selector.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ impl<T> TryFrom<TokenStream2> for SelectorMacro<T> {
219219
let input_span = input.span();
220220

221221
// Parse as a punctuated list - we require exactly 2 arguments
222-
let parser = syn::punctuated::Punctuated::<syn::Expr, syn::Token![,]>::parse_terminated;
222+
let parser =
223+
syn::punctuated::Punctuated::<syn::Expr, syn::Token![,]>::parse_terminated;
223224
let exprs = parser.parse2(input.clone()).map_err(|error| {
224225
format_err!(
225226
input_span,

crates/ink/macro/src/lib.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ pub fn blake2x256(input: TokenStream) -> TokenStream {
6767
/// # Note
6868
///
6969
/// - The computation takes place at compilation time of the crate.
70-
/// - Requires an ABI parameter as the first argument to specify the selector computation method.
70+
/// - Requires an ABI parameter as the first argument to specify the selector computation
71+
/// method.
7172
///
7273
/// # Arguments
7374
///
@@ -95,7 +96,8 @@ pub fn selector_id(input: TokenStream) -> TokenStream {
9596
/// # Note
9697
///
9798
/// - The computation takes place at compilation time of the crate.
98-
/// - Requires an ABI parameter as the first argument to specify the selector computation method.
99+
/// - Requires an ABI parameter as the first argument to specify the selector computation
100+
/// method.
99101
///
100102
/// # Arguments
101103
///
@@ -108,10 +110,16 @@ pub fn selector_id(input: TokenStream) -> TokenStream {
108110
/// # use ink_macro::selector_bytes;
109111
/// # use ink_primitives::abi::Abi;
110112
/// // ink! ABI (BLAKE-2)
111-
/// assert_eq!(selector_bytes!(Abi::Ink, Abi::Ink, "hello"), [50, 77, 207, 2],);
113+
/// assert_eq!(
114+
/// selector_bytes!(Abi::Ink, Abi::Ink, "hello"),
115+
/// [50, 77, 207, 2],
116+
/// );
112117
///
113118
/// // Solidity ABI (Keccak-256)
114-
/// assert_eq!(selector_bytes!(Abi::Ink, Abi::Sol, "hello"), [0x1c, 0x8a, 0xff, 0x95],);
119+
/// assert_eq!(
120+
/// selector_bytes!(Abi::Ink, Abi::Sol, "hello"),
121+
/// [0x1c, 0x8a, 0xff, 0x95],
122+
/// );
115123
/// ```
116124
#[proc_macro]
117125
pub fn selector_bytes(input: TokenStream) -> TokenStream {

integration-tests/internal/own-code-hash/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ mod own_code_hash {
5656
.code_hash(code_hash)
5757
.endowment(0.into())
5858
.exec_input(ink::env::call::ExecutionInput::new(
59-
ink::env::call::Selector::new(ink::selector_bytes!(Abi::Ink, "new")),
59+
ink::env::call::Selector::new(ink::selector_bytes!(
60+
Abi::Ink,
61+
"new"
62+
)),
6063
))
6164
.returns::<OwnCodeHashRef>()
6265
.params();

integration-tests/public/contract-invocation/lib.rs

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ mod instantiate_contract {
3131
let create_params = build_create::<Contract1Ref>()
3232
.code_hash(code_hash)
3333
.endowment(0.into())
34-
.exec_input(ExecutionInput::new(Selector::new(ink::selector_bytes!(Abi::Ink,
34+
.exec_input(ExecutionInput::new(Selector::new(ink::selector_bytes!(
35+
Abi::Ink,
3536
"new"
3637
))))
3738
.salt_bytes(Some(salt_bytes))
@@ -57,7 +58,8 @@ mod instantiate_contract {
5758
let create_params = build_create::<Contract2Ref>()
5859
.code_hash(code_hash)
5960
.endowment(0.into())
60-
.exec_input(ExecutionInput::new(Selector::new(ink::selector_bytes!(Abi::Ink,
61+
.exec_input(ExecutionInput::new(Selector::new(ink::selector_bytes!(
62+
Abi::Ink,
6163
"new"
6264
))))
6365
.salt_bytes(Some(salt_bytes))
@@ -81,7 +83,8 @@ mod instantiate_contract {
8183
let call = build_call()
8284
.call(contract1_address)
8385
.transferred_value(0.into())
84-
.exec_input(ExecutionInput::new(Selector::new(ink::selector_bytes!(Abi::Ink,
86+
.exec_input(ExecutionInput::new(Selector::new(ink::selector_bytes!(
87+
Abi::Ink,
8588
"get_x"
8689
))))
8790
.returns::<u32>()
@@ -100,7 +103,8 @@ mod instantiate_contract {
100103
let call = build_call()
101104
.call(contract2_address)
102105
.transferred_value(0.into())
103-
.exec_input(ExecutionInput::new(Selector::new(ink::selector_bytes!(Abi::Ink,
106+
.exec_input(ExecutionInput::new(Selector::new(ink::selector_bytes!(
107+
Abi::Ink,
104108
"get_x"
105109
))))
106110
.returns::<u32>()
@@ -120,8 +124,11 @@ mod instantiate_contract {
120124
.call(contract1_address)
121125
.transferred_value(0.into())
122126
.exec_input(
123-
ExecutionInput::new(Selector::new(ink::selector_bytes!(Abi::Ink, "set_x")))
124-
.push_arg(new_x),
127+
ExecutionInput::new(Selector::new(ink::selector_bytes!(
128+
Abi::Ink,
129+
"set_x"
130+
)))
131+
.push_arg(new_x),
125132
)
126133
.returns::<()>()
127134
.params();
@@ -140,8 +147,11 @@ mod instantiate_contract {
140147
.call(contract2_address)
141148
.transferred_value(0.into())
142149
.exec_input(
143-
ExecutionInput::new(Selector::new(ink::selector_bytes!(Abi::Ink, "set_x")))
144-
.push_arg(new_x),
150+
ExecutionInput::new(Selector::new(ink::selector_bytes!(
151+
Abi::Ink,
152+
"set_x"
153+
)))
154+
.push_arg(new_x),
145155
)
146156
.returns::<()>()
147157
.params();
@@ -258,7 +268,8 @@ mod instantiate_contract {
258268
let create_params = build_create::<VirtualContractVer1Ref>()
259269
.code_hash(code_hash2)
260270
.endowment(0.into())
261-
.exec_input(ExecutionInput::new(Selector::new(ink::selector_bytes!(Abi::Ink,
271+
.exec_input(ExecutionInput::new(Selector::new(ink::selector_bytes!(
272+
Abi::Ink,
262273
"new"
263274
))))
264275
.returns::<VirtualContractVer1Ref>()
@@ -280,7 +291,8 @@ mod instantiate_contract {
280291
let create_params = build_create::<VirtualContractVer2Ref>()
281292
.code_hash(code_hash3)
282293
.endowment(0.into())
283-
.exec_input(ExecutionInput::new(Selector::new(ink::selector_bytes!(Abi::Ink,
294+
.exec_input(ExecutionInput::new(Selector::new(ink::selector_bytes!(
295+
Abi::Ink,
284296
"new"
285297
))))
286298
.returns::<VirtualContractVer2Ref>()

integration-tests/public/contract-invocation/virtual_contract/lib.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ pub mod virtual_contract {
4141
let call = build_call()
4242
.delegate(self.version)
4343
.exec_input(
44-
ExecutionInput::new(Selector::new(ink::selector_bytes!(Abi::Ink, "set_x")))
45-
.push_arg(x),
44+
ExecutionInput::new(Selector::new(ink::selector_bytes!(
45+
Abi::Ink,
46+
"set_x"
47+
)))
48+
.push_arg(x),
4649
)
4750
.returns::<()>()
4851
.params();
@@ -61,7 +64,8 @@ pub mod virtual_contract {
6164
pub fn get_x(&self) -> u32 {
6265
let call = build_call()
6366
.delegate(self.version)
64-
.exec_input(ExecutionInput::new(Selector::new(ink::selector_bytes!(Abi::Ink,
67+
.exec_input(ExecutionInput::new(Selector::new(ink::selector_bytes!(
68+
Abi::Ink,
6569
"get_x"
6670
))))
6771
.returns::<u32>()

integration-tests/public/debugging-strategies/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ mod debugging_strategies {
6868
let create_params = build_create::<FlipperRef>()
6969
.code_hash(code_hash)
7070
.endowment(0.into())
71-
.exec_input(ExecutionInput::new(Selector::new(ink::selector_bytes!(Abi::Ink,
71+
.exec_input(ExecutionInput::new(Selector::new(ink::selector_bytes!(
72+
Abi::Ink,
7273
"new"
7374
))))
7475
.returns::<FlipperRef>()
@@ -92,7 +93,8 @@ mod debugging_strategies {
9293
let call = build_call()
9394
.call(ink::ToAddr::to_addr(&other))
9495
.transferred_value(0.into())
95-
.exec_input(ExecutionInput::new(Selector::new(ink::selector_bytes!(Abi::Ink,
96+
.exec_input(ExecutionInput::new(Selector::new(ink::selector_bytes!(
97+
Abi::Ink,
9698
"get"
9799
))))
98100
.returns::<bool>()

0 commit comments

Comments
 (0)