Skip to content

Comments

refactor: remove the crate bstr from the dependency#102

Open
jaudiger wants to merge 1 commit intomainfrom
remove-bstr-dep
Open

refactor: remove the crate bstr from the dependency#102
jaudiger wants to merge 1 commit intomainfrom
remove-bstr-dep

Conversation

@jaudiger
Copy link
Contributor

This PR simplifies a bit the brioche-runtime-utils codebase by removing the crate bstr to instead rely exclusively on methods from std. The main advantage to use the methods from the standard is there are infaillible which removes a bunch of indirection in the code that were related to error handling (which explains the removal of 100 lines).

We still need bstr but it's now a transitive dependency.

@jaudiger jaudiger requested a review from kylewlacy January 15, 2026 19:37
@jaudiger jaudiger self-assigned this Jan 15, 2026
@jaudiger
Copy link
Contributor Author

On main:

image

With this PR:

image

@kylewlacy
Copy link
Member

I think it'll take some research on my part before I'm ready to merge this 😅

I looked at the docs for both std::ffi::OsStr and bstr on how paths and OS strings are converted to/from bytes, and I'm not clear if bstr and std are equivalent here or not. We don't support Windows (today) so that's probably not a factor, but I'm not sure how each handles e.g. a path with an invalid UTF-8 sequence. (I'm also not sure if this is a real concern today since I also don't know if we have any packages today that use non-UTF-8 paths anywhere....)

Signed-off-by: Jérémy Audiger <jeremy.audiger@icloud.com>
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