summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/seek_from_current.rs
blob: 5d9b1424cf686fe5bd1ec150b86c7e8d6a7f0d3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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() {}