Skip to content

Commit 9ff5275

Browse files
authored
Rollup merge of rust-lang#62644 - arnottcr:std_io-doc, r=steveklabnik
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
2 parents a17951c + e8e13f0 commit 9ff5275

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libstd/io/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ pub trait Write {
11051105
/// an [`Err`] variant.
11061106
///
11071107
/// If the return value is [`Ok(n)`] then it must be guaranteed that
1108-
/// `0 <= n <= buf.len()`. A return value of `0` typically means that the
1108+
/// `n <= buf.len()`. A return value of `0` typically means that the
11091109
/// underlying object is no longer able to accept bytes and will likely not
11101110
/// be able to in the future as well, or that the buffer provided is empty.
11111111
///

0 commit comments

Comments
 (0)