-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unwrap
is not that safe ...
#39
Comments
seems like the panic happen when those kind of values arrive in the #[cfg(test)]
mod tests {
use std::path::PathBuf;
#[test]
fn a_test() {
let path = PathBuf::from("./plop.file");
path.strip_prefix("plop.file").unwrap();
}
} called `Result::unwrap()` on an `Err` value: StripPrefixError(())
stack backtrace:
0: rust_begin_unwind
1: core::panicking::panic_fmt
2: core::result::unwrap_failed |
What invocation of globwalk did you use to get this? |
lock file is on the latest version [[package]]
name = "globwalk"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bf760ebf69878d9fd8f110c89703d90ce35095324d1f1edcb595c63945ee757"
dependencies = [
"bitflags 2.5.0",
"ignore",
"walkdir",
] a failing case would be as simple as this one : #[cfg(test)]
mod tests {
#[test]
fn test() -> anyhow::Result<()> {
let all_files = globwalk::GlobWalkerBuilder::from_patterns("./src", &[""])
.build()?
.filter_map(Result::ok);
for file in all_files {
dbg!(file);
}
Ok(())
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
it seems that an
unwrap
considered safe, is panicking.globwalk/src/lib.rs
Line 381 in 8973fa2
The text was updated successfully, but these errors were encountered: