From e8e13f04b2218fbc5faa9774a1b5bba9296f3389 Mon Sep 17 00:00:00 2001 From: Colin Arnott Date: Sat, 13 Jul 2019 01:34:00 +0000 Subject: [PATCH] simplify std::io::Write::write rustdoc The std::io::Write::write method currensly suggests consumers guaranteed that `0 <= n <= buf.len()`, for `Ok(n)`, however `n` is of type `usize` causing the compiler to emit a warning: ``` warning: comparison is useless due to type limits --> lib.rs:6:18 | 6 | Ok(n) => 0 <= n && n <= output.len(), | ^^^^^^ | = note: #[warn(unused_comparisons)] on by default ``` This PR removes the suggestion to check `0 <= n` since it is moot. r? @steveklabnik --- src/libstd/io/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index a8d4d1181aa4f..ebe68dba6e6ed 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -1105,7 +1105,7 @@ pub trait Write { /// an [`Err`] variant. /// /// If the return value is [`Ok(n)`] then it must be guaranteed that - /// `0 <= n <= buf.len()`. A return value of `0` typically means that the + /// `n <= buf.len()`. A return value of `0` typically means that the /// underlying object is no longer able to accept bytes and will likely not /// be able to in the future as well, or that the buffer provided is empty. ///