]> git.lizzy.rs Git - rust.git/blob - tests/ui/unused_io_amount.rs
Auto merge of #6336 - giraffate:sync-from-rust, r=flip1995
[rust.git] / tests / ui / unused_io_amount.rs
1 #![allow(dead_code)]
2 #![warn(clippy::unused_io_amount)]
3
4 use std::io;
5
6 fn question_mark<T: io::Read + io::Write>(s: &mut T) -> io::Result<()> {
7     s.write(b"test")?;
8     let mut buf = [0u8; 4];
9     s.read(&mut buf)?;
10     Ok(())
11 }
12
13 fn unwrap<T: io::Read + io::Write>(s: &mut T) {
14     s.write(b"test").unwrap();
15     let mut buf = [0u8; 4];
16     s.read(&mut buf).unwrap();
17 }
18
19 fn vectored<T: io::Read + io::Write>(s: &mut T) -> io::Result<()> {
20     s.read_vectored(&mut [io::IoSliceMut::new(&mut [])])?;
21     s.write_vectored(&[io::IoSlice::new(&[])])?;
22     Ok(())
23 }
24
25 fn main() {}