Skip to content

Commit

Permalink
Rollup merge of rust-lang#62644 - arnottcr:std_io-doc, r=steveklabnik
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Centril authored Aug 1, 2019
2 parents 8a58268 + e8e13f0 commit 757a14a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libstd/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down

0 comments on commit 757a14a

Please sign in to comment.