process: Add must_use annotations to all futures

This commit is contained in:
Ivan Petkov
2019-06-24 16:56:50 -07:00
parent 914b803429
commit 34e71fa71a
3 changed files with 6 additions and 0 deletions
+4
View File
@@ -263,6 +263,7 @@ impl CommandExt for process::Command {
/// > done because futures in general take `drop` as a sign of cancellation, and
/// > this `Child` is itself a future. If you'd like to run a process in the
/// > background, though, you may use the `forget` method.
#[must_use = "futures do nothing unless polled"]
#[derive(Debug)]
pub struct Child {
child: imp::Child,
@@ -372,6 +373,7 @@ impl Drop for Child {
///
/// This future will resolve to the standard library's `Output` type which
/// contains the exit status, stdout, and stderr of a child process.
#[must_use = "futures do nothing unless polled"]
pub struct WaitWithOutput {
inner: IoFuture<Output>,
}
@@ -398,6 +400,7 @@ impl Future for WaitWithOutput {
/// This future is used to conveniently spawn a child and simply wait for its
/// exit status. This future will resolves to the `ExitStatus` type in the
/// standard library.
#[must_use = "futures do nothing unless polled"]
#[derive(Debug)]
pub struct StatusAsync {
inner: Flatten<FutureResult<Child, io::Error>>,
@@ -417,6 +420,7 @@ impl Future for StatusAsync {
/// This future is mostly equivalent to spawning a process and then calling
/// `wait_with_output` on it internally. This can be useful to simply spawn a
/// process, collecting all of its output and its exit status.
#[must_use = "futures do nothing unless polled"]
pub struct OutputAsync {
inner: IoFuture<Output>,
}
+1
View File
@@ -40,6 +40,7 @@ use std::fmt;
use tokio_io::IoFuture;
use tokio_core::reactor::{Handle, PollEvented};
#[must_use = "futures do nothing unless polled"]
pub struct Child {
inner: process::Child,
reaped: bool,
+1
View File
@@ -31,6 +31,7 @@ use futures::future::Fuse;
use self::mio_named_pipes::NamedPipe;
use tokio_core::reactor::{PollEvented, Handle};
#[must_use = "futures do nothing unless polled"]
pub struct Child {
child: process::Child,
waiting: Option<Waiting>,