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

unnecessary_move lint, removing move with no effect #8751

Open
sukyoungjeong-furiosa opened this issue Apr 26, 2022 · 3 comments
Open

unnecessary_move lint, removing move with no effect #8751

sukyoungjeong-furiosa opened this issue Apr 26, 2022 · 3 comments
Labels
A-lint Area: New lints

Comments

@sukyoungjeong-furiosa
Copy link

sukyoungjeong-furiosa commented Apr 26, 2022

What it does

clippy reports no warnings for unnecessary move keyword, such as:

let closure = move || value_moved(v);

Here move is unnecessary since there's no reference capture.

If a lint for above is acceptable, we may also have some warnings for belows.

std::thread::spawn(move || { value_moved(v) }

or

tokio::spawn(async move || value_moved_async(v).await})

Lint Name

unnecessary_move

Category

style

Advantage

  • Brings minimalism.

Drawbacks

No response

Example

move || value_moved(v);

Could be written as:

|| value_moved(v);
@sukyoungjeong-furiosa sukyoungjeong-furiosa added the A-lint Area: New lints label Apr 26, 2022
@Kinrany
Copy link

Kinrany commented Dec 16, 2024

Duplicate of #11721 #8751

@smoelius
Copy link
Contributor

Duplicate of #8751

@Kinrany Did you mean to post this on a different issue? #11721 maybe?

@Kinrany
Copy link

Kinrany commented Dec 16, 2024

🤦 Yes, thank you!
(Technically that issue is newer and would be a duplicate of this one, but the former actually has some discussion on it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints
Projects
None yet
Development

No branches or pull requests

3 participants