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

wgpu backend: Remove unneeded cloned() when creating texture arrays #108

Closed
wants to merge 1 commit into from

Conversation

dlight
Copy link
Contributor

@dlight dlight commented Oct 13, 2019

Related to #107

@dlight
Copy link
Contributor Author

dlight commented Oct 13, 2019

Also related to #7

Copy link
Contributor Author

@dlight dlight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol it didn't work

@dlight
Copy link
Contributor Author

dlight commented Oct 13, 2019

After struggling a bit, it turns out there's two ways to write this without cloned

let slice: Vec<u8> = layers.iter().map(|i| i.iter()).flatten().map(|i| *i).collect();

let slice: Vec<u8> = layers.iter().map(|i| *i).flatten().map(|i| *i).collect();

(playground link)

But in the end, it probably doesn't matter because u8 is small and Copy (cloning it isn't "bad"). So I'm closing it.

@dlight dlight closed this Oct 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant