diff options
author | Taiki Endo <te316e89@gmail.com> | 2019-07-16 05:28:56 +0900 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2019-07-15 13:28:56 -0700 |
commit | b14e189e44d6588ca4437ecbc2ca97ab7dedd925 (patch) | |
tree | 0e86b347a6e776a74210480ae75fa0235befd3d2 /tokio-fs/src | |
parent | 2dde2b448faecea425555b91c004802a61e079f2 (diff) |
add #[must_use] to more futures and streams (#1309)
Diffstat (limited to 'tokio-fs/src')
-rw-r--r-- | tokio-fs/src/create_dir.rs | 1 | ||||
-rw-r--r-- | tokio-fs/src/create_dir_all.rs | 1 | ||||
-rw-r--r-- | tokio-fs/src/file/clone.rs | 1 | ||||
-rw-r--r-- | tokio-fs/src/file/create.rs | 1 | ||||
-rw-r--r-- | tokio-fs/src/file/metadata.rs | 1 | ||||
-rw-r--r-- | tokio-fs/src/file/open.rs | 1 | ||||
-rw-r--r-- | tokio-fs/src/file/seek.rs | 1 | ||||
-rw-r--r-- | tokio-fs/src/hard_link.rs | 1 | ||||
-rw-r--r-- | tokio-fs/src/metadata.rs | 1 | ||||
-rw-r--r-- | tokio-fs/src/read.rs | 1 | ||||
-rw-r--r-- | tokio-fs/src/read_dir.rs | 2 | ||||
-rw-r--r-- | tokio-fs/src/read_link.rs | 1 | ||||
-rw-r--r-- | tokio-fs/src/remove_dir.rs | 1 | ||||
-rw-r--r-- | tokio-fs/src/remove_file.rs | 1 | ||||
-rw-r--r-- | tokio-fs/src/rename.rs | 1 | ||||
-rw-r--r-- | tokio-fs/src/set_permissions.rs | 1 | ||||
-rw-r--r-- | tokio-fs/src/symlink_metadata.rs | 1 | ||||
-rw-r--r-- | tokio-fs/src/write.rs | 1 |
18 files changed, 19 insertions, 0 deletions
diff --git a/tokio-fs/src/create_dir.rs b/tokio-fs/src/create_dir.rs index ac784075..f691a2b9 100644 --- a/tokio-fs/src/create_dir.rs +++ b/tokio-fs/src/create_dir.rs @@ -17,6 +17,7 @@ pub fn create_dir<P: AsRef<Path>>(path: P) -> CreateDirFuture<P> { /// Future returned by `create_dir`. #[derive(Debug)] +#[must_use = "futures do nothing unless you `.await` or poll them"] pub struct CreateDirFuture<P> where P: AsRef<Path>, diff --git a/tokio-fs/src/create_dir_all.rs b/tokio-fs/src/create_dir_all.rs index 914c0b17..d9a84eb2 100644 --- a/tokio-fs/src/create_dir_all.rs +++ b/tokio-fs/src/create_dir_all.rs @@ -18,6 +18,7 @@ pub fn create_dir_all<P: AsRef<Path>>(path: P) -> CreateDirAllFuture<P> { /// Future returned by `create_dir_all`. #[derive(Debug)] +#[must_use = "futures do nothing unless you `.await` or poll them"] pub struct CreateDirAllFuture<P> where P: AsRef<Path>, diff --git a/tokio-fs/src/file/clone.rs b/tokio-fs/src/file/clone.rs index 24a44306..899f3346 100644 --- a/tokio-fs/src/file/clone.rs +++ b/tokio-fs/src/file/clone.rs @@ -13,6 +13,7 @@ use std::task::Poll; /// /// Will panic if polled after returning an item or error. #[derive(Debug)] +#[must_use = "futures do nothing unless you `.await` or poll them"] pub struct CloneFuture { file: Option<File>, } diff --git a/tokio-fs/src/file/create.rs b/tokio-fs/src/file/create.rs index bc4661cb..41ca554f 100644 --- a/tokio-fs/src/file/create.rs +++ b/tokio-fs/src/file/create.rs @@ -8,6 +8,7 @@ use std::task::Context; use std::task::Poll; /// Future returned by `File::create` and resolves to a `File` instance. +#[must_use = "futures do nothing unless you `.await` or poll them"] #[derive(Debug)] pub struct CreateFuture<P> { path: P, diff --git a/tokio-fs/src/file/metadata.rs b/tokio-fs/src/file/metadata.rs index a5aa4683..67be837a 100644 --- a/tokio-fs/src/file/metadata.rs +++ b/tokio-fs/src/file/metadata.rs @@ -11,6 +11,7 @@ const POLL_AFTER_RESOLVE: &str = "Cannot poll MetadataFuture after it resolves"; /// Future returned by `File::metadata` and resolves to a `(File, Metadata)` instance. #[derive(Debug)] +#[must_use = "futures do nothing unless you `.await` or poll them"] pub struct MetadataFuture { file: Option<File>, } diff --git a/tokio-fs/src/file/open.rs b/tokio-fs/src/file/open.rs index 5f7915ee..c25c2e1f 100644 --- a/tokio-fs/src/file/open.rs +++ b/tokio-fs/src/file/open.rs @@ -9,6 +9,7 @@ use std::task::Poll; /// Future returned by `File::open` and resolves to a `File` instance. #[derive(Debug)] +#[must_use = "futures do nothing unless you `.await` or poll them"] pub struct OpenFuture<P: Unpin> { options: StdOpenOptions, path: P, diff --git a/tokio-fs/src/file/seek.rs b/tokio-fs/src/file/seek.rs index be0d997d..18ee4329 100644 --- a/tokio-fs/src/file/seek.rs +++ b/tokio-fs/src/file/seek.rs @@ -7,6 +7,7 @@ use std::task::Poll; /// Future returned by `File::seek`. #[derive(Debug)] +#[must_use = "futures do nothing unless you `.await` or poll them"] pub struct SeekFuture { inner: Option<File>, pos: io::SeekFrom, diff --git a/tokio-fs/src/hard_link.rs b/tokio-fs/src/hard_link.rs index b4a023b3..e18bac17 100644 --- a/tokio-fs/src/hard_link.rs +++ b/tokio-fs/src/hard_link.rs @@ -20,6 +20,7 @@ pub fn hard_link<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> HardLinkFutu /// Future returned by `hard_link`. #[derive(Debug)] +#[must_use = "futures do nothing unless you `.await` or poll them"] pub struct HardLinkFuture<P, Q> where P: AsRef<Path>, diff --git a/tokio-fs/src/metadata.rs b/tokio-fs/src/metadata.rs index 11a25249..e54a5851 100644 --- a/tokio-fs/src/metadata.rs +++ b/tokio-fs/src/metadata.rs @@ -17,6 +17,7 @@ where /// Future returned by `metadata`. #[derive(Debug)] +#[must_use = "futures do nothing unless you `.await` or poll them"] pub struct MetadataFuture<P> where P: AsRef<Path> + Send + 'static, diff --git a/tokio-fs/src/read.rs b/tokio-fs/src/read.rs index cfd0afe3..a6e1a98f 100644 --- a/tokio-fs/src/read.rs +++ b/tokio-fs/src/read.rs @@ -38,6 +38,7 @@ where /// A future used to open a file and read its entire contents into a buffer. #[derive(Debug)] +#[must_use = "futures do nothing unless you `.await` or poll them"] pub struct ReadFile<P: AsRef<Path> + Send + Unpin + 'static> { state: State<P>, } diff --git a/tokio-fs/src/read_dir.rs b/tokio-fs/src/read_dir.rs index 01e36d01..9585518b 100644 --- a/tokio-fs/src/read_dir.rs +++ b/tokio-fs/src/read_dir.rs @@ -24,6 +24,7 @@ where /// Future returned by `read_dir`. #[derive(Debug)] +#[must_use = "futures do nothing unless you `.await` or poll them"] pub struct ReadDirFuture<P> where P: AsRef<Path> + Send + 'static, @@ -68,6 +69,7 @@ where /// [`Stream`]: ../futures/stream/trait.Stream.html /// [`Err`]: https://doc.rust-lang.org/std/result/enum.Result.html#variant.Err #[derive(Debug)] +#[must_use = "streams do nothing unless polled"] pub struct ReadDir(StdReadDir); impl Stream for ReadDir { diff --git a/tokio-fs/src/read_link.rs b/tokio-fs/src/read_link.rs index d5b9fe2d..980f922e 100644 --- a/tokio-fs/src/read_link.rs +++ b/tokio-fs/src/read_link.rs @@ -17,6 +17,7 @@ pub fn read_link<P: AsRef<Path>>(path: P) -> ReadLinkFuture<P> { /// Future returned by `read_link`. #[derive(Debug)] +#[must_use = "futures do nothing unless you `.await` or poll them"] pub struct ReadLinkFuture<P> where P: AsRef<Path>, diff --git a/tokio-fs/src/remove_dir.rs b/tokio-fs/src/remove_dir.rs index b0de35e1..3e666c68 100644 --- a/tokio-fs/src/remove_dir.rs +++ b/tokio-fs/src/remove_dir.rs @@ -17,6 +17,7 @@ pub fn remove_dir<P: AsRef<Path>>(path: P) -> RemoveDirFuture<P> { /// Future returned by `remove_dir`. #[derive(Debug)] +#[must_use = "futures do nothing unless you `.await` or poll them"] pub struct RemoveDirFuture<P> where P: AsRef<Path>, diff --git a/tokio-fs/src/remove_file.rs b/tokio-fs/src/remove_file.rs index ca8b8088..b09eae77 100644 --- a/tokio-fs/src/remove_file.rs +++ b/tokio-fs/src/remove_file.rs @@ -21,6 +21,7 @@ pub fn remove_file<P: AsRef<Path>>(path: P) -> RemoveFileFuture<P> { /// Future returned by `remove_file`. #[derive(Debug)] +#[must_use = "futures do nothing unless you `.await` or poll them"] pub struct RemoveFileFuture<P> where P: AsRef<Path>, diff --git a/tokio-fs/src/rename.rs b/tokio-fs/src/rename.rs index 742ced04..670a9c7d 100644 --- a/tokio-fs/src/rename.rs +++ b/tokio-fs/src/rename.rs @@ -20,6 +20,7 @@ pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> RenameFuture<P, /// Future returned by `rename`. #[derive(Debug)] +#[must_use = "futures do nothing unless you `.await` or poll them"] pub struct RenameFuture<P, Q> where P: AsRef<Path>, diff --git a/tokio-fs/src/set_permissions.rs b/tokio-fs/src/set_permissions.rs index d5bdfd67..e91c33b8 100644 --- a/tokio-fs/src/set_permissions.rs +++ b/tokio-fs/src/set_permissions.rs @@ -17,6 +17,7 @@ pub fn set_permissions<P: AsRef<Path>>(path: P, perm: fs::Permissions) -> SetPer /// Future returned by `set_permissions`. #[derive(Debug)] +#[must_use = "futures do nothing unless you `.await` or poll them"] pub struct SetPermissionsFuture<P> where P: AsRef<Path>, diff --git a/tokio-fs/src/symlink_metadata.rs b/tokio-fs/src/symlink_metadata.rs index cc450959..0cae53c5 100644 --- a/tokio-fs/src/symlink_metadata.rs +++ b/tokio-fs/src/symlink_metadata.rs @@ -21,6 +21,7 @@ where /// Future returned by `symlink_metadata`. #[derive(Debug)] +#[must_use = "futures do nothing unless you `.await` or poll them"] pub struct SymlinkMetadataFuture<P> where P: AsRef<Path> + Send + 'static, diff --git a/tokio-fs/src/write.rs b/tokio-fs/src/write.rs index 4b63984c..d3d357ca 100644 --- a/tokio-fs/src/write.rs +++ b/tokio-fs/src/write.rs @@ -41,6 +41,7 @@ where /// A future used to open a file for writing and write the entire contents /// of some data to it. #[derive(Debug)] +#[must_use = "futures do nothing unless you `.await` or poll them"] pub struct WriteFile<P: AsRef<Path> + Send + Unpin + 'static, C: AsRef<[u8]> + Unpin> { state: State<P, C>, } |