Skip to content

Commit 20150e1

Browse files
committed
Replace expect
1 parent d40366e commit 20150e1

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

gix-ref/src/store/file/overlay_iter.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use crate::{
1212
BStr, FullName, Namespace, Reference,
1313
};
1414

15+
use gix_object::bstr::ByteSlice;
1516
use gix_path::relative_path::RelativePath;
1617

1718
/// An iterator stepping through sorted input of loose references and packed references, preferring loose refs over otherwise
@@ -391,11 +392,8 @@ impl file::Store {
391392
self.iter_from_info(git_dir_info, common_dir_info, packed)
392393
}
393394
Some(namespace) => {
394-
let prefix = namespace
395-
.to_owned()
396-
.into_namespaced_prefix(prefix)
397-
.try_into()
398-
.expect("TODO");
395+
let prefix = namespace.to_owned().into_namespaced_prefix(prefix);
396+
let prefix = prefix.as_bstr().try_into().map_err(|err| std::io::Error::other(err))?;
399397
let git_dir_info = IterInfo::from_prefix(self.git_dir(), prefix, self.precompose_unicode)?;
400398
let common_dir_info = self
401399
.common_dir()

gix/src/open/repository.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use crate::{
1111
ThreadSafeRepository,
1212
};
1313
use gix_features::threading::OwnShared;
14+
use gix_object::bstr::ByteSlice;
1415
use std::ffi::OsStr;
1516
use std::{borrow::Cow, path::PathBuf};
1617

@@ -348,7 +349,7 @@ impl ThreadSafeRepository {
348349
.and_then(|prefix| {
349350
let _span = gix_trace::detail!("find replacement objects");
350351
let platform = refs.iter().ok()?;
351-
let iter = platform.prefixed(prefix.clone().try_into().expect("TODO")).ok()?;
352+
let iter = platform.prefixed(prefix.as_bstr().try_into().ok()?).ok()?;
352353
let replacements = iter
353354
.filter_map(Result::ok)
354355
.filter_map(|r: gix_ref::Reference| {

0 commit comments

Comments
 (0)