Skip to content

Commit

Permalink
Use Into<Self> for all full_mul impls
Browse files Browse the repository at this point in the history
  • Loading branch information
chipshort committed Sep 15, 2023
1 parent 7b2e753 commit ced7859
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/std/src/math/int128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl Int128 {
/// ```
#[must_use = "this returns the result of the operation, without modifying the original"]
pub fn full_mul(self, rhs: impl Into<Self>) -> Int256 {
Int256::from(self.i128())
Int256::from(self)
.checked_mul(Int256::from(rhs.into()))
.unwrap()
}
Expand Down
4 changes: 2 additions & 2 deletions packages/std/src/math/uint128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ impl Uint128 {
/// assert_eq!(result.to_string(), "680564733841876926926749214863536422910");
/// ```
#[must_use = "this returns the result of the operation, without modifying the original"]
pub fn full_mul(self, rhs: impl Into<u128>) -> Uint256 {
Uint256::from(self.u128())
pub fn full_mul(self, rhs: impl Into<Self>) -> Uint256 {
Uint256::from(self)
.checked_mul(Uint256::from(rhs.into()))
.unwrap()
}
Expand Down
2 changes: 1 addition & 1 deletion packages/std/src/math/uint256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl Uint256 {
/// );
/// ```
#[must_use = "this returns the result of the operation, without modifying the original"]
pub fn full_mul(self, rhs: impl Into<Uint256>) -> Uint512 {
pub fn full_mul(self, rhs: impl Into<Self>) -> Uint512 {
Uint512::from(self)
.checked_mul(Uint512::from(rhs.into()))
.unwrap()
Expand Down
4 changes: 2 additions & 2 deletions packages/std/src/math/uint64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ impl Uint64 {
/// assert_eq!(result.to_string(), "36893488147419103230");
/// ```
#[must_use = "this returns the result of the operation, without modifying the original"]
pub fn full_mul(self, rhs: impl Into<u64>) -> Uint128 {
Uint128::from(self.u64())
pub fn full_mul(self, rhs: impl Into<Self>) -> Uint128 {
Uint128::from(self)
.checked_mul(Uint128::from(rhs.into()))
.unwrap()
}
Expand Down

0 comments on commit ced7859

Please # to comment.