Skip to content

Commit

Permalink
fix a clippy warning
Browse files Browse the repository at this point in the history
  • Loading branch information
larry0x committed Feb 18, 2023
1 parent 21471b9 commit b8c58b5
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions contracts/cw2981-royalties/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,19 @@ pub mod entry {
info: MessageInfo,
msg: ExecuteMsg,
) -> Result<Response, ContractError> {
if let ExecuteMsg::Mint { extension, .. } = &msg {
if let ExecuteMsg::Mint {
extension:
Some(Metadata {
royalty_percentage: Some(royalty_percentage),
..
}),
..
} = &msg
{
// validate royalty_percentage to be between 0 and 100
if let Some(Metadata {
royalty_percentage: Some(royalty_percentage),
..
}) = extension
{
// no need to check < 0 because royalty_percentage is u64
if *royalty_percentage > 100 {
return Err(ContractError::InvalidRoyaltyPercentage);
}
// no need to check < 0 because royalty_percentage is u64
if *royalty_percentage > 100 {
return Err(ContractError::InvalidRoyaltyPercentage);
}
}

Expand Down

0 comments on commit b8c58b5

Please sign in to comment.