Skip to content

chore: avoid panic when parsing --dir argument#12604

Closed
Ocheretovich wants to merge 1 commit intobytecodealliance:mainfrom
Ocheretovich:main
Closed

chore: avoid panic when parsing --dir argument#12604
Ocheretovich wants to merge 1 commit intobytecodealliance:mainfrom
Ocheretovich:main

Conversation

@Ocheretovich
Copy link

Avoid potential panic when parsing --dir argument by returning a proper error instead of unwrapping

Signed-off-by: Ocheretovich Oksana <ocheretovich@gmail.com>
@Ocheretovich Ocheretovich requested a review from a team as a code owner February 17, 2026 09:40
@Ocheretovich Ocheretovich requested review from pchickey and removed request for a team February 17, 2026 09:40
Copy link
Contributor

@pchickey pchickey left a comment

Choose a reason for hiding this comment

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

Did you find an input that can create this panic? From the docs of split

https://doc.rust-lang.org/std/primitive.str.html#method.split

Returns an iterator over substrings of this string slice, separated by characters matched by a pattern.
...
If there are no matches the full string slice is returned as the only item in the iterator.

by my reading, the iterator given by split will always contain at least one value, therefore the first call to next will always give Some.

@pchickey pchickey closed this Feb 17, 2026
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.

2 participants