Rust

Rust

By DeepSource

Found manual implementation of Seek::rewind RS-W1046

Anti-pattern

Calling Seek::seek with SeekFrom::Start(0) as the position is equivalent to Seek::rewind. Consider using Seek::rewind to improve readibility.

Examples

Bad practice

fn foo<T: io::Seek>(t: T) {
    t.seek(SeekFrom::Start(0));
}

Recommended

fn foo<T: io::Seek>(t: T) {
    t.rewind();
}