Skip to content

Commit 497d75b

Browse files
committed
Add #[must_use] to constructors
1 parent 8538b9c commit 497d75b

File tree

12 files changed

+14
-0
lines changed

12 files changed

+14
-0
lines changed

packages/std/src/math/decimal.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ impl Decimal {
5353
/// assert_eq!(value.to_string(), "141183460469231731687.303715884105727125");
5454
/// ```
5555
#[inline]
56+
#[must_use]
5657
pub const fn new(value: Uint128) -> Self {
5758
Self(value)
5859
}

packages/std/src/math/decimal256.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ impl Decimal256 {
5858
/// assert_eq!(value.to_string(), "141183460469231731687.303715884105727125");
5959
/// ```
6060
#[inline]
61+
#[must_use]
6162
pub const fn new(value: Uint256) -> Self {
6263
Self(value)
6364
}

packages/std/src/math/int128.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ impl Int128 {
4747
///
4848
/// This method is less flexible than `from` but can be called in a const context.
4949
#[inline]
50+
#[must_use]
5051
pub const fn new(value: i128) -> Self {
5152
Self(value)
5253
}

packages/std/src/math/int256.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ impl Int256 {
6464
///
6565
/// [`from_be_bytes`]: Self::from_be_bytes
6666
#[inline]
67+
#[must_use]
6768
pub const fn new(value: i128) -> Self {
6869
Self::from_be_bytes(grow_be_int(value.to_be_bytes()))
6970
}

packages/std/src/math/int512.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ impl Int512 {
6565
///
6666
/// [`from_be_bytes`]: Self::from_be_bytes
6767
#[inline]
68+
#[must_use]
6869
pub const fn new(value: i128) -> Self {
6970
Self::from_be_bytes(grow_be_int(value.to_be_bytes()))
7071
}

packages/std/src/math/int64.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ impl Int64 {
4747
///
4848
/// This method is less flexible than `from` but can be called in a const context.
4949
#[inline]
50+
#[must_use]
5051
pub const fn new(value: i64) -> Self {
5152
Self(value)
5253
}

packages/std/src/math/signed_decimal.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ impl SignedDecimal {
7373
/// assert_eq!(value.to_string(), "-141183460469231731687.303715884105727125");
7474
/// ```
7575
#[inline]
76+
#[must_use]
7677
pub const fn new(value: Int128) -> Self {
7778
Self(value)
7879
}

packages/std/src/math/signed_decimal_256.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ impl SignedDecimal256 {
8585
/// assert_eq!(value.to_string(), "-141183460469231731687.303715884105727125");
8686
/// ```
8787
#[inline]
88+
#[must_use]
8889
pub const fn new(value: Int256) -> Self {
8990
Self(value)
9091
}

packages/std/src/math/uint128.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ impl Uint128 {
5454
/// Creates a Uint128(value).
5555
///
5656
/// This method is less flexible than `from` but can be called in a const context.
57+
#[inline]
58+
#[must_use]
5759
pub const fn new(value: u128) -> Self {
5860
Uint128(value)
5961
}

packages/std/src/math/uint256.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ impl Uint256 {
6464
/// with [`from_be_bytes`].
6565
///
6666
/// [`from_be_bytes`]: Self::from_be_bytes
67+
#[must_use]
6768
pub const fn new(value: u128) -> Self {
6869
let b = value.to_be_bytes();
6970
Self::from_be_bytes([

0 commit comments

Comments
 (0)