Skip to content

Commit

Permalink
chore: remove use of .get
Browse files Browse the repository at this point in the history
  • Loading branch information
friedger committed Oct 18, 2023
1 parent 571b0dc commit 462562e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions stacks-core/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,9 @@ impl TryFrom<String> for PrincipalData {
}
2 => {
let address = StacksAddress::try_from(parts[0])?;
let contract_name = parts
.get(1)
.ok_or(StacksError::InvalidData("No contract name"))
.and_then(|name| {
ContractName::new(name).map_err(|_err| {
StacksError::InvalidData("Invalid contract name")
})
let contract_name =
ContractName::new(parts[1]).map_err(|_err| {
StacksError::InvalidData("Invalid contract name")
})?;

Ok(Self::Contract(
Expand Down

0 comments on commit 462562e

Please sign in to comment.