Skip to content

Convert UTF-8 errors to errors rather than None#1274

Merged
weihanglo merged 4 commits into
rust-lang:mainfrom
DanielEScherzer:return-better-results
Jun 11, 2026
Merged

Convert UTF-8 errors to errors rather than None#1274
weihanglo merged 4 commits into
rust-lang:mainfrom
DanielEScherzer:return-better-results

Conversation

@DanielEScherzer

Copy link
Copy Markdown
Contributor

No description provided.

Test that invalid UTF8 is represented as `Ok(None)` rather than an error, so
that the behavior change in the next commit is visible.
Comment thread src/repo.rs Outdated
Convert `std::str::Utf8Error` into a git2 `Error` object and return an error
case, rather than silently switching to `Ok(None)`.
Test that invalid UTF-8 is represented as `Ok(None)` rather than an error, so
that the behavior change in the next commit is visible.
Convert `std::str::Utf8Error` into a git2 `Error` object and return an error
case, rather than silently switching to `Ok(None)`. Since UTF-8 errors were the
only way `Ok(None)` could be returned, switch from returning
`Result<Option<&str>, Error>` to returning `Result<&str, Error>` now that the
UTF-8 errors are handled with the `Err` variant.
@DanielEScherzer DanielEScherzer force-pushed the return-better-results branch from 3ba6911 to 397d7ab Compare June 11, 2026 20:45
@weihanglo weihanglo added this pull request to the merge queue Jun 11, 2026
Merged via the queue into rust-lang:main with commit 9a08ba3 Jun 11, 2026
7 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Waiting on review label Jun 11, 2026
@DanielEScherzer DanielEScherzer deleted the return-better-results branch June 11, 2026 21:51
@ehuss ehuss added the semver-breaking-change A SemVer breaking change that will require a new SemVer-incompatible version number bump. label Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-breaking-change A SemVer breaking change that will require a new SemVer-incompatible version number bump.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants