Skip to content

Prefer Seek#rewind() over Seek#seek(SeekFrom::Start(0)) #8600

Closed
@frewsxcv

Description

@frewsxcv

What it does

Suggests using the helper shortcut method, which is shorter.

https://doc.rust-lang.org/stable/std/io/trait.Seek.html#method.rewind

Lint Name

No response

Category

No response

Advantage

No response

Drawbacks

No response

Example

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

Could be written as:

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

Metadata

Metadata

Assignees

Labels

A-lintArea: New lintsgood first issueThese issues are a good way to get started with Clippy

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions