Skip to content

Commit 63a6ca1

Browse files
committed
Apply cargo fmt
1 parent 00e526f commit 63a6ca1

File tree

10 files changed

+21
-21
lines changed

10 files changed

+21
-21
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl<T> TryFrom<TokenStream2> for SelectorMacro<T> {
218218
fn try_from(input: TokenStream2) -> Result<Self, Self::Error> {
219219
let input_span = input.span();
220220

221-
// Parse as a punctuated list - we require exactly 2 arguments
221+
// Parse as a punctuated list, we require exactly 2 arguments
222222
let parser =
223223
syn::punctuated::Punctuated::<syn::Expr, syn::Token![,]>::parse_terminated;
224224
let exprs = parser.parse2(input.clone()).map_err(|error| {

crates/ink/macro/src/lib.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ pub fn blake2x256(input: TokenStream) -> TokenStream {
7272
///
7373
/// # Arguments
7474
///
75-
/// - `Abi::Ink` - Uses ink! ABI (BLAKE-2 256-bit hash)
76-
/// - `Abi::Sol` - Uses Solidity ABI (Keccak-256 hash)
75+
/// - `Abi::Ink`: Uses ink! ABI (BLAKE-2 256-bit hash)
76+
/// - `Abi::Sol`: Uses Solidity ABI (Keccak-256 hash)
7777
///
7878
/// # Example
7979
///
@@ -101,25 +101,19 @@ pub fn selector_id(input: TokenStream) -> TokenStream {
101101
///
102102
/// # Arguments
103103
///
104-
/// - `Abi::Ink` - Uses ink! ABI (BLAKE-2 256-bit hash)
105-
/// - `Abi::Sol` - Uses Solidity ABI (Keccak-256 hash)
104+
/// - `Abi::Ink`: Uses ink! ABI (BLAKE-2 256-bit hash)
105+
/// - `Abi::Sol`: Uses Solidity ABI (Keccak-256 hash)
106106
///
107107
/// # Example
108108
///
109109
/// ```
110110
/// # use ink_macro::selector_bytes;
111111
/// # use ink_primitives::abi::Abi;
112112
/// // ink! ABI (BLAKE-2)
113-
/// assert_eq!(
114-
/// selector_bytes!(Abi::Ink, Abi::Ink, "hello"),
115-
/// [50, 77, 207, 2],
116-
/// );
113+
/// assert_eq!(selector_bytes!(Abi::Ink, "hello"), [50, 77, 207, 2],);
117114
///
118115
/// // Solidity ABI (Keccak-256)
119-
/// assert_eq!(
120-
/// selector_bytes!(Abi::Ink, Abi::Sol, "hello"),
121-
/// [0x1c, 0x8a, 0xff, 0x95],
122-
/// );
116+
/// assert_eq!(selector_bytes!(Abi::Sol, "hello"), [0x1c, 0x8a, 0xff, 0x95],);
123117
/// ```
124118
#[proc_macro]
125119
pub fn selector_bytes(input: TokenStream) -> TokenStream {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
const _: u32 = ink::selector_bytes!(Abi::Ink, Abi::Ink, true);
1+
const _: u32 = ink::selector_bytes!(Abi::Ink, , true);
22

33
fn main() {}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
const _: u32 = ink::selector_bytes!(Abi::Ink, Abi::Ink, 42);
1+
const _: u32 = ink::selector_bytes!(Abi::Ink, , 42);
22

33
fn main() {}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
const INPUT: &str = "test";
2-
const _: u32 = ink::selector_bytes!(Abi::Ink, Abi::Ink, INPUT);
2+
const _: u32 = ink::selector_bytes!(Abi::Ink, , INPUT);
33

44
fn main() {}

crates/ink/tests/ui/selector_bytes/pass/bytestring_input.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use ink_ir as ir;
33
macro_rules! assert_macro_eq {
44
( $input:literal ) => {{
55
// We put it into a constant to verify that the computation is constant.
6-
const HASH: [u8; 4] = ink::selector_bytes!(Abi::Ink, Abi::Ink, $input);
6+
const HASH: [u8; 4] = ink::selector_bytes!(Abi::Ink, , $input);
77
assert_eq!(
88
HASH,
99
ir::Selector::compute($input, ir::SelectorAbi::Ink).to_bytes(),
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![no_implicit_prelude]
22

3-
const _: [::core::primitive::u8; 4] = ::ink::selector_bytes!(Abi::Ink, Abi::Ink, "test");
3+
const _: [::core::primitive::u8; 4] = ::ink::selector_bytes!(Abi::Ink, , "test");
44

55
fn main() {}

crates/ink/tests/ui/selector_bytes/pass/string_input.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use ink_ir as ir;
33
macro_rules! assert_macro_eq {
44
( $input:literal ) => {{
55
// We put it into a constant to verify that the computation is constant.
6-
const HASH: [u8; 4] = ink::selector_bytes!(Abi::Ink, Abi::Ink, $input);
6+
const HASH: [u8; 4] = ink::selector_bytes!(Abi::Ink, , $input);
77
assert_eq!(
88
HASH,
99
ir::Selector::compute($input.as_bytes(), ir::SelectorAbi::Ink).to_bytes(),

crates/ink/tests/ui/trait_def/pass/message-name-override.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@ fn main() {
2626
}
2727
}
2828

29-
assert_selector_eq!("myMessage", selector_bytes!(Abi::Ink, "TraitDefinition::myMessage"),);
29+
assert_selector_eq!(
30+
"myMessage",
31+
selector_bytes!(Abi::Ink, "TraitDefinition::myMessage"),
32+
);
3033
}

crates/ink/tests/ui/trait_def/pass/valid_selectors.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ fn main() {
3131
}
3232
}
3333

34-
assert_selector_eq!("message1", selector_bytes!(Abi::Ink, "TraitDefinition::message1"),);
34+
assert_selector_eq!(
35+
"message1",
36+
selector_bytes!(Abi::Ink, "TraitDefinition::message1"),
37+
);
3538
assert_selector_eq!("message2", [0, 0, 0, 42],);
3639
assert_selector_eq!("message3", [0xC0, 0xDE, 0xCA, 0xFE],);
3740
}

0 commit comments

Comments
 (0)