Skip to content

Commit 2b2eb90

Browse files
committed
Add #[must_use] to From::from and Into::into
1 parent b6585ec commit 2b2eb90

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

core/src/convert/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ pub trait AsMut<T: ?Sized> {
273273
#[stable(feature = "rust1", since = "1.0.0")]
274274
pub trait Into<T>: Sized {
275275
/// Performs the conversion.
276+
#[must_use]
276277
#[stable(feature = "rust1", since = "1.0.0")]
277278
fn into(self) -> T;
278279
}
@@ -367,6 +368,7 @@ pub trait Into<T>: Sized {
367368
pub trait From<T>: Sized {
368369
/// Performs the conversion.
369370
#[lang = "from"]
371+
#[must_use]
370372
#[stable(feature = "rust1", since = "1.0.0")]
371373
fn from(_: T) -> Self;
372374
}

0 commit comments

Comments
 (0)