diff options
Diffstat (limited to 'src/tools/clippy/tests/ui/seek_from_current.fixed')
-rw-r--r-- | src/tools/clippy/tests/ui/seek_from_current.fixed | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/seek_from_current.fixed b/src/tools/clippy/tests/ui/seek_from_current.fixed new file mode 100644 index 000000000..1309c91b8 --- /dev/null +++ b/src/tools/clippy/tests/ui/seek_from_current.fixed @@ -0,0 +1,25 @@ +// run-rustfix +#![warn(clippy::seek_from_current)] + +use std::fs::File; +use std::io::{self, Seek, SeekFrom, Write}; + +#[clippy::msrv = "1.50"] +fn _msrv_1_50() -> io::Result<()> { + let mut f = File::create("foo.txt")?; + f.write_all(b"Hi!")?; + f.seek(SeekFrom::Current(0))?; + f.seek(SeekFrom::Current(1))?; + Ok(()) +} + +#[clippy::msrv = "1.51"] +fn _msrv_1_51() -> io::Result<()> { + let mut f = File::create("foo.txt")?; + f.write_all(b"Hi!")?; + f.stream_position()?; + f.seek(SeekFrom::Current(1))?; + Ok(()) +} + +fn main() {} |