Skip to content

Commit

Permalink
Merge branch 'master' into IGI-111/parser-panics
Browse files Browse the repository at this point in the history
  • Loading branch information
ironcev authored Sep 30, 2023
2 parents 6c91b6b + db55f17 commit 180bcfb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions sway-lib-std/src/identity.sw
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use ::call_frames::contract_id;
use ::constants::{ZERO_B256, BASE_ASSET_ID};
use ::contract_id::{AssetId, ContractId};
use ::hash::*;
use ::option::Option;
use ::option::Option::{self, *};

/// The `Identity` type: either an `Address` or a `ContractId`.
// ANCHOR: docs_identity
Expand Down Expand Up @@ -49,8 +49,8 @@ impl Identity {
/// ```
pub fn as_address(self) -> Option<Address> {
match self {
Self::Address(addr) => Option::Some(addr),
Self::ContractId(_) => Option::None,
Self::Address(addr) => Some(addr),
Self::ContractId(_) => None,
}
}

Expand All @@ -73,8 +73,8 @@ impl Identity {
/// ```
pub fn as_contract_id(self) -> Option<ContractId> {
match self {
Self::Address(_) => Option::None,
Self::ContractId(id) => Option::Some(id),
Self::Address(_) => None,
Self::ContractId(id) => Some(id),
}
}

Expand Down
10 changes: 5 additions & 5 deletions sway-lib-std/src/outputs.sw
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use ::tx::{
Transaction,
tx_type,
};
use ::option::*;
use ::option::Option::{self, *};

// GTF Opcode const selectors
//
Expand Down Expand Up @@ -220,8 +220,8 @@ pub fn output_amount(index: u64) -> u64 {
/// ```
pub fn output_asset_id(index: u64) -> Option<AssetId> {
match output_type(index) {
Output::Coin => Option::Some(AssetId::from(__gtf::<b256>(index, GTF_OUTPUT_COIN_ASSET_ID))),
_ => Option::None,
Output::Coin => Some(AssetId::from(__gtf::<b256>(index, GTF_OUTPUT_COIN_ASSET_ID))),
_ => None,
}
}

Expand Down Expand Up @@ -252,7 +252,7 @@ pub fn output_asset_id(index: u64) -> Option<AssetId> {
/// ```
pub fn output_asset_to(index: u64) -> Option<b256> {
match output_type(index) {
Output::Coin => Option::Some(__gtf::<b256>(index, GTF_OUTPUT_COIN_TO)),
_ => Option::None,
Output::Coin => Some(__gtf::<b256>(index, GTF_OUTPUT_COIN_TO)),
_ => None,
}
}
8 changes: 4 additions & 4 deletions sway-lib-std/src/storage/storage_string.sw
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
library;

use ::bytes::Bytes;
use ::option::Option;
use ::option::Option::{self, *};
use ::storage::storable_slice::*;
use ::storage::storage_api::read;
use ::string::String;
Expand Down Expand Up @@ -78,10 +78,10 @@ impl StorableSlice<String> for StorageKey<StorageString> {
#[storage(read)]
fn read_slice(self) -> Option<String> {
match read_slice(self.slot) {
Option::Some(slice) => {
Option::Some(String::from(slice))
Some(slice) => {
Some(String::from(slice))
},
Option::None => Option::None,
None => None,
}
}

Expand Down
2 changes: 1 addition & 1 deletion sway-lib-std/src/vec.sw
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ impl<T> Vec<T> {
pub fn get(self, index: u64) -> Option<T> {
// First check that index is within bounds.
if self.len <= index {
return Option::None;
return None;
};

// Get a pointer to the desired element using `index`
Expand Down

0 comments on commit 180bcfb

Please sign in to comment.