Skip to content

Commit

Permalink
use strip_prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
kayagokalp committed Jun 6, 2024
1 parent 992bfdd commit 842bbb9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions forc-pkg/src/manifest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,9 @@ impl FromStr for HexSalt {

fn from_str(s: &str) -> Result<Self, Self::Err> {
// cut 0x from start.
let normalized = &s[2..];
if &s[0..2] != "0x" {
anyhow::bail!("hex salt definition needs to start with 0x.")
}
let normalized = s
.strip_prefix("0x")
.ok_or_else(|| anyhow::anyhow!("hex salt declaration needs to start with 0x"))?;
let salt: fuel_tx::Salt =
fuel_tx::Salt::from_str(normalized).map_err(|e| anyhow::anyhow!("{e}"))?;
let hex_salt = Self(salt);
Expand Down

0 comments on commit 842bbb9

Please sign in to comment.