mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
fe8c2e24bd
We introduce the following rules for match exprs. - `panic!` and `unreachable!` are treated as consumption. - guard expressions in any arm imply consumption. For match exprs: - Lint only if exacrtly 2 non-consuming arms exist - Lint only if one arm is an `Ok(_)` and the other is `Err(_)` Added additional requirement that for a block return expression that is a match, the source must be `Normal`. changelog: FP [`unused_io_amount`] when matching Ok(literal)
264 lines
7.9 KiB
Text
264 lines
7.9 KiB
Text
error: written amount is not handled
|
|
--> $DIR/unused_io_amount.rs:10:5
|
|
|
|
|
LL | s.write(b"test")?;
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `Write::write_all` instead, or handle partial writes
|
|
= note: `-D clippy::unused-io-amount` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::unused_io_amount)]`
|
|
|
|
error: read amount is not handled
|
|
--> $DIR/unused_io_amount.rs:13:5
|
|
|
|
|
LL | s.read(&mut buf)?;
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `Read::read_exact` instead, or handle partial reads
|
|
|
|
error: written amount is not handled
|
|
--> $DIR/unused_io_amount.rs:19:5
|
|
|
|
|
LL | s.write(b"test").unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `Write::write_all` instead, or handle partial writes
|
|
|
|
error: read amount is not handled
|
|
--> $DIR/unused_io_amount.rs:22:5
|
|
|
|
|
LL | s.read(&mut buf).unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `Read::read_exact` instead, or handle partial reads
|
|
|
|
error: read amount is not handled
|
|
--> $DIR/unused_io_amount.rs:27:5
|
|
|
|
|
LL | s.read_vectored(&mut [io::IoSliceMut::new(&mut [])])?;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: written amount is not handled
|
|
--> $DIR/unused_io_amount.rs:29:5
|
|
|
|
|
LL | s.write_vectored(&[io::IoSlice::new(&[])])?;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: read amount is not handled
|
|
--> $DIR/unused_io_amount.rs:37:5
|
|
|
|
|
LL | reader.read(&mut result).ok()?;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `Read::read_exact` instead, or handle partial reads
|
|
|
|
error: read amount is not handled
|
|
--> $DIR/unused_io_amount.rs:47:5
|
|
|
|
|
LL | reader.read(&mut result).or_else(|err| Err(err))?;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `Read::read_exact` instead, or handle partial reads
|
|
|
|
error: read amount is not handled
|
|
--> $DIR/unused_io_amount.rs:60:5
|
|
|
|
|
LL | reader.read(&mut result).or(Err(Error::Kind))?;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `Read::read_exact` instead, or handle partial reads
|
|
|
|
error: read amount is not handled
|
|
--> $DIR/unused_io_amount.rs:68:5
|
|
|
|
|
LL | / reader
|
|
LL | |
|
|
LL | | .read(&mut result)
|
|
LL | | .or(Err(Error::Kind))
|
|
LL | | .or(Err(Error::Kind))
|
|
LL | | .expect("error");
|
|
| |________________________^
|
|
|
|
|
= help: use `Read::read_exact` instead, or handle partial reads
|
|
|
|
error: written amount is not handled
|
|
--> $DIR/unused_io_amount.rs:78:5
|
|
|
|
|
LL | s.write(b"ok").is_ok();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `Write::write_all` instead, or handle partial writes
|
|
|
|
error: written amount is not handled
|
|
--> $DIR/unused_io_amount.rs:80:5
|
|
|
|
|
LL | s.write(b"err").is_err();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `Write::write_all` instead, or handle partial writes
|
|
|
|
error: read amount is not handled
|
|
--> $DIR/unused_io_amount.rs:83:5
|
|
|
|
|
LL | s.read(&mut buf).is_ok();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `Read::read_exact` instead, or handle partial reads
|
|
|
|
error: read amount is not handled
|
|
--> $DIR/unused_io_amount.rs:85:5
|
|
|
|
|
LL | s.read(&mut buf).is_err();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `Read::read_exact` instead, or handle partial reads
|
|
|
|
error: written amount is not handled
|
|
--> $DIR/unused_io_amount.rs:90:5
|
|
|
|
|
LL | w.write(b"hello world").await.unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `AsyncWriteExt::write_all` instead, or handle partial writes
|
|
|
|
error: read amount is not handled
|
|
--> $DIR/unused_io_amount.rs:96:5
|
|
|
|
|
LL | r.read(&mut buf[..]).await.unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `AsyncReadExt::read_exact` instead, or handle partial reads
|
|
|
|
error: written amount is not handled
|
|
--> $DIR/unused_io_amount.rs:104:5
|
|
|
|
|
LL | w.write(b"hello world");
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `AsyncWriteExt::write_all` instead, or handle partial writes
|
|
|
|
error: written amount is not handled
|
|
--> $DIR/unused_io_amount.rs:110:9
|
|
|
|
|
LL | w.write(b"hello world").await?;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `AsyncWriteExt::write_all` instead, or handle partial writes
|
|
|
|
error: read amount is not handled
|
|
--> $DIR/unused_io_amount.rs:119:9
|
|
|
|
|
LL | r.read(&mut buf[..]).await.or(Err(Error::Kind))?;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `AsyncReadExt::read_exact` instead, or handle partial reads
|
|
|
|
error: written amount is not handled
|
|
--> $DIR/unused_io_amount.rs:128:5
|
|
|
|
|
LL | w.write(b"hello world").await.unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `AsyncWriteExt::write_all` instead, or handle partial writes
|
|
|
|
error: read amount is not handled
|
|
--> $DIR/unused_io_amount.rs:134:5
|
|
|
|
|
LL | r.read(&mut buf[..]).await.unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `AsyncReadExt::read_exact` instead, or handle partial reads
|
|
|
|
error: written amount is not handled
|
|
--> $DIR/unused_io_amount.rs:147:11
|
|
|
|
|
LL | match s.write(b"test") {
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `Write::write_all` instead, or handle partial writes
|
|
note: the result is consumed here, but the amount of I/O bytes remains unhandled
|
|
--> $DIR/unused_io_amount.rs:149:9
|
|
|
|
|
LL | Ok(_) => todo!(),
|
|
| ^^^^^
|
|
|
|
error: read amount is not handled
|
|
--> $DIR/unused_io_amount.rs:155:11
|
|
|
|
|
LL | match s.read(&mut buf) {
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `Read::read_exact` instead, or handle partial reads
|
|
note: the result is consumed here, but the amount of I/O bytes remains unhandled
|
|
--> $DIR/unused_io_amount.rs:157:9
|
|
|
|
|
LL | Ok(_) => todo!(),
|
|
| ^^^^^
|
|
|
|
error: read amount is not handled
|
|
--> $DIR/unused_io_amount.rs:164:11
|
|
|
|
|
LL | match s.read(&mut [0u8; 4]) {
|
|
| ^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `Read::read_exact` instead, or handle partial reads
|
|
note: the result is consumed here, but the amount of I/O bytes remains unhandled
|
|
--> $DIR/unused_io_amount.rs:166:9
|
|
|
|
|
LL | Ok(_) => todo!(),
|
|
| ^^^^^
|
|
|
|
error: written amount is not handled
|
|
--> $DIR/unused_io_amount.rs:173:11
|
|
|
|
|
LL | match s.write(b"test") {
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `Write::write_all` instead, or handle partial writes
|
|
note: the result is consumed here, but the amount of I/O bytes remains unhandled
|
|
--> $DIR/unused_io_amount.rs:175:9
|
|
|
|
|
LL | Ok(_) => todo!(),
|
|
| ^^^^^
|
|
|
|
error: read amount is not handled
|
|
--> $DIR/unused_io_amount.rs:186:8
|
|
|
|
|
LL | if let Ok(_) = s.read(&mut [0u8; 4]) {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `Read::read_exact` instead, or handle partial reads
|
|
note: the result is consumed here, but the amount of I/O bytes remains unhandled
|
|
--> $DIR/unused_io_amount.rs:186:12
|
|
|
|
|
LL | if let Ok(_) = s.read(&mut [0u8; 4]) {
|
|
| ^^^^^
|
|
|
|
error: written amount is not handled
|
|
--> $DIR/unused_io_amount.rs:193:8
|
|
|
|
|
LL | if let Ok(_) = s.write(b"test") {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `Write::write_all` instead, or handle partial writes
|
|
note: the result is consumed here, but the amount of I/O bytes remains unhandled
|
|
--> $DIR/unused_io_amount.rs:193:12
|
|
|
|
|
LL | if let Ok(_) = s.write(b"test") {
|
|
| ^^^^^
|
|
|
|
error: written amount is not handled
|
|
--> $DIR/unused_io_amount.rs:200:8
|
|
|
|
|
LL | if let Ok(..) = s.write(b"test") {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= help: use `Write::write_all` instead, or handle partial writes
|
|
note: the result is consumed here, but the amount of I/O bytes remains unhandled
|
|
--> $DIR/unused_io_amount.rs:200:12
|
|
|
|
|
LL | if let Ok(..) = s.write(b"test") {
|
|
| ^^^^^^
|
|
|
|
error: aborting due to 28 previous errors
|
|
|