replace panicking unwrap with explicit panic in build.rs#724
Open
anaslimem wants to merge 1 commit intounum-cloud:mainfrom
Open
replace panicking unwrap with explicit panic in build.rs#724anaslimem wants to merge 1 commit intounum-cloud:mainfrom
anaslimem wants to merge 1 commit intounum-cloud:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Resolves a
clippy::panicking_unwraplint error in the Rustbuild.rsscript.Previously, if compiling the
usearchC++ backend failed ( due to missing system headers like<omp.h>on macOS), the build script would unconditionally call.unwrap()on the resultingErr. This caused a generic panic that obscured the actual underlying compiler error and triggered aclippywarning.Why is this necessary?
Unwrapping an
Errvalue is discouraged bycargo clippybecause it leads to unhelpful error messages:This PR replaces the
.unwrap()with an explicitpanic!that surfaces the exactcxxToolExecError message. This makes debugging C++ dependency issues duringcargo buildsignificantly easier for developers and users.Testing
Verified locally that:
cargo clippy --all-targets --all-featurespasses with zero errors/warnings.cargo test -p usearchsucceeds with all 14 tests passing.libompnow cleanly displays thefatal error: 'omp.h' file not foundmessage instead of a generic unwrap tracing panic.