Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
frewsxcv opened this issue Mar 28, 2022 · 12 comments · Fixed by #9667
Closed

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

frewsxcv opened this issue Mar 28, 2022 · 12 comments · Fixed by #9667
Assignees
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy

Comments

@frewsxcv
Copy link
Member

frewsxcv commented Mar 28, 2022

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();
}
@frewsxcv frewsxcv added the A-lint Area: New lints label Mar 28, 2022
@giraffate giraffate added the good-first-issue These issues are a good way to get started with Clippy label Mar 29, 2022
@J-ZhengLi
Copy link
Member

J-ZhengLi commented Mar 29, 2022

seems interesting...
@rustbot claim

on a second thought... maybe it'd be better to give other people this chance consider it's a good-first-issue~

@J-ZhengLi J-ZhengLi removed their assignment Mar 29, 2022
@brleinad
Copy link

@rustbot claim

@J-ZhengLi I'm still new to Rust and this would be my first contribution to clippy so would you be available for questions if I run into issues?

@J-ZhengLi
Copy link
Member

@rustbot claim

@J-ZhengLi I'm still new to Rust and this would be my first contribution to clippy so would you be available for questions if I run into issues?

Sure, but I doubt if I could be anyway near as helpful as the official members lol.

@giraffate
Copy link
Contributor

@brleinad If you have any questions, you can ask me too. Or you can ask on the zulip chat.

@brleinad
Copy link

A quick update:
I've been working on this on and off for the last two weeks but I've been pretty busy with other things so progress is slow. I might not be able to work on it until May. If anybody else is interested in taking this while I'm away here's the Zulip thread.

@Rqnsom
Copy link
Contributor

Rqnsom commented Jul 23, 2022

Is it okay if I take over this one?

@Rqnsom
Copy link
Contributor

Rqnsom commented Aug 2, 2022

@brleinad Ping me when you continue working on this. I've prepared a draft commit (for my learning purposes) which is partially done. I can share it with you since maybe it can help you.
Edit: I'm also trying to work on beginner issues so maybe we can learn together

@brleinad
Copy link

Thanks for that @Rqnsom! Life has been too busy in the last few weeks to work on any Rust projects 😢 so feel free to take this over. I'm sorry for the late reply.

@Rqnsom
Copy link
Contributor

Rqnsom commented Aug 16, 2022

Life has been too busy in the last few weeks to work on any Rust projects

@brleinad No worries, I feel ya!

I'll see if I can do it during the next week maybe.

@rustbot claim

@frewsxcv
Copy link
Member Author

@Rqnsom Are you still working on this?

@Rqnsom
Copy link
Contributor

Rqnsom commented Oct 10, 2022

Not really. Wanted to. But I couldn't find the time.

@Rqnsom Rqnsom removed their assignment Oct 10, 2022
@dblnz
Copy link
Contributor

dblnz commented Oct 11, 2022

I would like to give it a go if nobody else is working on this, it would be my first contribution to clippy.

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants