Skip to content

try_from_into.rs: Improve slice implementation#2317

Open
EugenDueck wants to merge 1 commit intorust-lang:mainfrom
EugenDueck:patch-1
Open

try_from_into.rs: Improve slice implementation#2317
EugenDueck wants to merge 1 commit intorust-lang:mainfrom
EugenDueck:patch-1

Conversation

@EugenDueck
Copy link

@EugenDueck EugenDueck commented Nov 29, 2025

Improves readability. In terms of performance, it probably doesn't matter, because the multiple bounds checks in the original are likely to get optimized away.

Using pattern matching, we can reduce four bound checks to just one.
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