From 4547b622d8d29df964fa2914213088b148c498fc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:32 +0200 Subject: Merging upstream version 1.67.1+dfsg1. Signed-off-by: Daniel Baumann --- src/tools/clippy/tests/ui/seek_from_current.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/tools/clippy/tests/ui/seek_from_current.rs (limited to 'src/tools/clippy/tests/ui/seek_from_current.rs') diff --git a/src/tools/clippy/tests/ui/seek_from_current.rs b/src/tools/clippy/tests/ui/seek_from_current.rs new file mode 100644 index 000000000..5d9b1424c --- /dev/null +++ b/src/tools/clippy/tests/ui/seek_from_current.rs @@ -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.seek(SeekFrom::Current(0))?; + f.seek(SeekFrom::Current(1))?; + Ok(()) +} + +fn main() {} -- cgit v1.2.3