Add #[must_use] to conversions that move self
This commit is contained in:
@@ -476,6 +476,7 @@ pub struct WriterPanicked {
|
||||
impl WriterPanicked {
|
||||
/// Returns the perhaps-unwritten data. Some of this data may have been written by the
|
||||
/// panicking call(s) to the underlying writer, so simply writing it again is not a good idea.
|
||||
#[must_use = "`self` will be dropped if the result is not used"]
|
||||
#[stable(feature = "bufwriter_into_parts", since = "1.56.0")]
|
||||
pub fn into_inner(self) -> Vec<u8> {
|
||||
self.buf
|
||||
|
||||
@@ -657,6 +657,7 @@ impl Error {
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "io_error_inner", since = "1.3.0")]
|
||||
#[must_use = "`self` will be dropped if the result is not used"]
|
||||
#[inline]
|
||||
pub fn into_inner(self) -> Option<Box<dyn error::Error + Send + Sync>> {
|
||||
match self.repr {
|
||||
|
||||
@@ -464,6 +464,7 @@ impl Stdin {
|
||||
/// println!("got a line: {}", line.unwrap());
|
||||
/// }
|
||||
/// ```
|
||||
#[must_use = "`self` will be dropped if the result is not used"]
|
||||
#[unstable(feature = "stdin_forwarders", issue = "87096")]
|
||||
pub fn lines(self) -> Lines<StdinLock<'static>> {
|
||||
self.into_locked().lines()
|
||||
|
||||
Reference in New Issue
Block a user