rust-clippy/tests/ui/seek_from_current.rs
koka 6efb3a2b9a
feat: add new lint seek_from_current
addresses https://github.com/rust-lang/rust-clippy/issues/7886
added `seek_from_current` complexity lint.
it checks use of `Seek#seek` with `SeekFrom::Current(0)` and
suggests `Seek#stream_position` method

fix: add msrv

fix: register LintInfo

fix: remove unnecessary files

fix: add test for msrv

fix: remove

fix

fix: remove docs
2022-10-25 12:26:06 +09:00

26 lines
602 B
Rust

// run-rustfix
#![warn(clippy::seek_from_current)]
#![feature(custom_inner_attributes)]
use std::fs::File;
use std::io::{self, Seek, SeekFrom, Write};
fn _msrv_1_50() -> io::Result<()> {
#![clippy::msrv = "1.50"]
let mut f = File::create("foo.txt")?;
f.write_all(b"Hi!")?;
f.seek(SeekFrom::Current(0))?;
f.seek(SeekFrom::Current(1))?;
Ok(())
}
fn _msrv_1_51() -> io::Result<()> {
#![clippy::msrv = "1.51"]
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() {}