From 2118c9a0846a92ffeb7a596182b9080560e96bd2 Mon Sep 17 00:00:00 2001 From: Cesar Rodas Date: Thu, 21 Dec 2023 17:58:22 -0300 Subject: [PATCH] Run forc-fmt with #5410 --- sway-lib-core/src/primitive_conversions.sw | 24 ++++++++++---------- sway-lib-core/src/raw_ptr.sw | 26 +++++++++++----------- sway-lib-core/src/raw_slice.sw | 4 ++-- sway-lib-core/src/str.sw | 8 +++---- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/sway-lib-core/src/primitive_conversions.sw b/sway-lib-core/src/primitive_conversions.sw index 5040473f675..3160a5eca02 100644 --- a/sway-lib-core/src/primitive_conversions.sw +++ b/sway-lib-core/src/primitive_conversions.sw @@ -18,7 +18,7 @@ impl u64 { /// ``` pub fn as_u256(self) -> u256 { let input = (0u64, 0u64, 0u64, self); - asm( input: input ) { + asm(input: input) { input: u256 } } @@ -41,7 +41,7 @@ impl u32 { /// } /// ``` pub fn as_u64(self) -> u64 { - asm( input: self ) { + asm(input: self) { input: u64 } } @@ -66,7 +66,7 @@ impl u32 { /// ``` pub fn as_u256(self) -> u256 { let input = (0u64, 0u64, 0u64, self.as_u64()); - asm( input: input ) { + asm(input: input) { input: u256 } } @@ -89,7 +89,7 @@ impl u16 { /// } /// ``` pub fn as_u32(self) -> u32 { - asm( input: self ) { + asm(input: self) { input: u32 } } @@ -110,7 +110,7 @@ impl u16 { /// } /// ``` pub fn as_u64(self) -> u64 { - asm( input: self ) { + asm(input: self) { input: u64 } } @@ -135,7 +135,7 @@ impl u16 { /// ``` pub fn as_u256(self) -> u256 { let input = (0u64, 0u64, 0u64, self.as_u64()); - asm( input: input ) { + asm(input: input) { input: u256 } } @@ -158,7 +158,7 @@ impl u8 { /// } /// ``` pub fn as_u16(self) -> u16 { - asm( input: self ) { + asm(input: self) { input: u16 } } @@ -179,7 +179,7 @@ impl u8 { /// } /// ``` pub fn as_u32(self) -> u32 { - asm( input: self ) { + asm(input: self) { input: u32 } } @@ -200,7 +200,7 @@ impl u8 { /// } /// ``` pub fn as_u64(self) -> u64 { - asm( input: self ) { + asm(input: self) { input: u64 } } @@ -225,7 +225,7 @@ impl u8 { /// ``` pub fn as_u256(self) -> u256 { let input = (0u64, 0u64, 0u64, self.as_u64()); - asm( input: input ) { + asm(input: input) { input: u256 } } @@ -248,7 +248,7 @@ impl b256 { /// } /// ``` pub fn as_u256(self) -> u256 { - asm( input: self ) { + asm(input: self) { input: u256 } } @@ -271,7 +271,7 @@ impl u256 { /// } /// ``` pub fn as_b256(self) -> b256 { - asm( input: self ) { + asm(input: self) { input: b256 } } diff --git a/sway-lib-core/src/raw_ptr.sw b/sway-lib-core/src/raw_ptr.sw index 1c8b3a9f2e4..5b8d487fc8d 100644 --- a/sway-lib-core/src/raw_ptr.sw +++ b/sway-lib-core/src/raw_ptr.sw @@ -94,16 +94,16 @@ impl raw_ptr { /// ``` pub fn read(self) -> T { if __is_reference_type::() { - asm( ptr: self ) { + asm(ptr: self) { ptr: T } } else if __eq(__size_of::(), 1) { - asm( ptr: self, val ) { + asm(ptr: self, val) { lb val ptr i0; val: T } } else { - asm( ptr: self, val ) { + asm(ptr: self, val) { lw val ptr i0; val: T } @@ -132,7 +132,7 @@ impl raw_ptr { /// ``` pub fn copy_to(self, dst: Self, count: u64) { let len = __mul(count, __size_of::()); - asm( dst: dst, src: self, len: len ) { + asm(dst: dst, src: self, len: len) { mcp dst src len; }; } @@ -154,15 +154,15 @@ impl raw_ptr { /// ``` pub fn write(self, val: T) { if __is_reference_type::() { - asm( dst: self, src: val, count: __size_of_val(val) ) { + asm(dst: self, src: val, count: __size_of_val(val)) { mcp dst src count; }; } else if __eq(__size_of::(), 1) { - asm( ptr: self, val: val ) { + asm(ptr: self, val: val) { sb ptr val i0; }; } else { - asm( ptr: self, val: val ) { + asm(ptr: self, val: val) { sw ptr val i0; }; } @@ -186,10 +186,10 @@ impl raw_ptr { /// } /// ``` pub fn write_byte(self, val: u8) { - let val_ptr = asm( r1: val ) { + let val_ptr = asm(r1: val) { r1: raw_ptr }; - asm( ptr: self, val: val_ptr ) { + asm(ptr: self, val: val_ptr) { sb ptr val i0; }; } @@ -212,7 +212,7 @@ impl raw_ptr { /// } /// ``` pub fn read_byte(self) -> u8 { - asm( r1: self, r2 ) { + asm(r1: self, r2) { lb r2 r1 i0; r2: u8 } @@ -239,7 +239,7 @@ impl raw_ptr { /// } /// ``` pub fn copy_bytes_to(self, dst: Self, count: u64) { - asm( dst: dst, src: self, len: count ) { + asm(dst: dst, src: self, len: count) { mcp dst src len; }; } @@ -267,7 +267,7 @@ impl raw_ptr { /// } /// ``` pub fn add_uint_offset(self, offset: u64) -> Self { - asm( ptr: self, offset: offset, new ) { + asm(ptr: self, offset: offset, new) { add new ptr offset; new: raw_ptr } @@ -296,7 +296,7 @@ impl raw_ptr { /// } /// ``` pub fn sub_uint_offset(self, offset: u64) -> Self { - asm( ptr: self, offset: offset, new ) { + asm(ptr: self, offset: offset, new) { sub new ptr offset; new: raw_ptr } diff --git a/sway-lib-core/src/raw_slice.sw b/sway-lib-core/src/raw_slice.sw index 3927376abea..13bd0affb90 100644 --- a/sway-lib-core/src/raw_slice.sw +++ b/sway-lib-core/src/raw_slice.sw @@ -49,7 +49,7 @@ pub trait AsRawSlice { /// /// * [raw_slice] - The newly created `raw_slice`. fn from_parts(parts: (raw_ptr, u64)) -> raw_slice { - asm( ptr: parts ) { + asm(ptr: parts) { ptr: raw_slice } } @@ -64,7 +64,7 @@ fn from_parts(parts: (raw_ptr, u64)) -> raw_slice { /// /// * [(raw_ptr, u64)] - A tuple of the location in memory of the original `raw_slice` and its length. fn into_parts(slice: raw_slice) -> (raw_ptr, u64) { - asm( ptr: slice ) { + asm(ptr: slice) { ptr: (raw_ptr, u64) } } diff --git a/sway-lib-core/src/str.sw b/sway-lib-core/src/str.sw index c2b67d4b0ca..27ddb173682 100644 --- a/sway-lib-core/src/str.sw +++ b/sway-lib-core/src/str.sw @@ -3,7 +3,7 @@ library; impl str { /// Return a `raw_ptr` to the beginning of the string slice on the heap pub fn as_ptr(self) -> raw_ptr { - let (ptr, _) = asm( s: self ) { + let (ptr, _) = asm(s: self) { s: (raw_ptr, u64) }; ptr @@ -11,7 +11,7 @@ impl str { /// Return the length of the string slice in bytes pub fn len(self) -> u64 { - let (_, len) = asm( s: self ) { + let (_, len) = asm(s: self) { s: (raw_ptr, u64) }; len @@ -23,14 +23,14 @@ pub fn from_str_array(s: S) -> str { let str_size = __size_of_str_array::(); let src = __addr_of(s); - let ptr = asm( size: __size_of::(), dest, src: src ) { + let ptr = asm(size: __size_of::(), dest, src: src) { aloc size; move dest hp; mcp dest src size; dest: raw_ptr }; - asm( s: (ptr, str_size) ) { + asm(s: (ptr, str_size)) { s: str } }