diff --git a/gix-config/src/file/impls.rs b/gix-config/src/file/impls.rs index 884e7ce346b..d6ac2b76a8f 100644 --- a/gix-config/src/file/impls.rs +++ b/gix-config/src/file/impls.rs @@ -42,7 +42,7 @@ impl<'a> TryFrom<&'a BStr> for File<'a> { impl From> for BString { fn from(c: File<'_>) -> Self { - c.into() + c.to_bstring() } } diff --git a/gix-config/src/parse/comment.rs b/gix-config/src/parse/comment.rs index 6d4bb15ffb5..6d7ec145b65 100644 --- a/gix-config/src/parse/comment.rs +++ b/gix-config/src/parse/comment.rs @@ -39,7 +39,7 @@ impl Display for Comment<'_> { impl From> for BString { fn from(c: Comment<'_>) -> Self { - c.into() + c.to_bstring() } } diff --git a/gix-config/src/parse/event.rs b/gix-config/src/parse/event.rs index f528e2077d6..d88ace7ce6c 100644 --- a/gix-config/src/parse/event.rs +++ b/gix-config/src/parse/event.rs @@ -72,7 +72,7 @@ impl Display for Event<'_> { impl From> for BString { fn from(event: Event<'_>) -> Self { - event.into() + event.to_bstring() } } diff --git a/gix-config/src/parse/section/header.rs b/gix-config/src/parse/section/header.rs index ad1288f3fe0..5f4e382c90a 100644 --- a/gix-config/src/parse/section/header.rs +++ b/gix-config/src/parse/section/header.rs @@ -145,7 +145,7 @@ impl Display for Header<'_> { impl From> for BString { fn from(header: Header<'_>) -> Self { - header.into() + header.to_bstring() } } diff --git a/gix-pack/src/cache/delta/from_offsets.rs b/gix-pack/src/cache/delta/from_offsets.rs index ee52f9ab9dd..fc807264d77 100644 --- a/gix-pack/src/cache/delta/from_offsets.rs +++ b/gix-pack/src/cache/delta/from_offsets.rs @@ -57,12 +57,14 @@ impl Tree { })?, ); - let anticipated_num_objects = if let Some(num_objects) = data_sorted_by_offsets.size_hint().1 { - progress.init(Some(num_objects), progress::count("objects")); - num_objects - } else { - 0 - }; + let anticipated_num_objects = data_sorted_by_offsets + .size_hint() + .1 + .map(|num_objects| { + progress.init(Some(num_objects), progress::count("objects")); + num_objects + }) + .unwrap_or_default(); let mut tree = Tree::with_capacity(anticipated_num_objects)?; { diff --git a/gix/src/config/cache/util.rs b/gix/src/config/cache/util.rs index 4c1d6c69399..df120fb75d8 100644 --- a/gix/src/config/cache/util.rs +++ b/gix/src/config/cache/util.rs @@ -132,10 +132,6 @@ pub trait ApplyLeniency { fn with_leniency(self, is_lenient: bool) -> Self; } -pub trait IgnoreEmptyPath { - fn ignore_empty(self) -> Self; -} - pub trait ApplyLeniencyDefault { fn with_lenient_default(self, is_lenient: bool) -> Self; } @@ -154,16 +150,6 @@ impl ApplyLeniency for Result, E> { } } -impl IgnoreEmptyPath for Result>, gix_config::path::interpolate::Error> { - fn ignore_empty(self) -> Self { - match self { - Ok(maybe_path) => Ok(maybe_path), - Err(gix_config::path::interpolate::Error::Missing { .. }) => Ok(None), - Err(err) => Err(err), - } - } -} - impl ApplyLeniencyDefault for Result where T: Default, diff --git a/gix/src/config/snapshot/credential_helpers.rs b/gix/src/config/snapshot/credential_helpers.rs index fdac608f541..f84efa896e8 100644 --- a/gix/src/config/snapshot/credential_helpers.rs +++ b/gix/src/config/snapshot/credential_helpers.rs @@ -6,7 +6,6 @@ use crate::config::cache::util::ApplyLeniency; use crate::{ bstr::{ByteSlice, ByteVec}, config::{ - cache::util::IgnoreEmptyPath, tree::{credential, gitoxide::Credentials, Core, Credential, Key}, Snapshot, }, @@ -197,3 +196,17 @@ fn normalize(url: &mut gix_url::Url) { url.path.pop(); } } + +trait IgnoreEmptyPath { + fn ignore_empty(self) -> Self; +} + +impl IgnoreEmptyPath for Result>, gix_config::path::interpolate::Error> { + fn ignore_empty(self) -> Self { + match self { + Ok(maybe_path) => Ok(maybe_path), + Err(gix_config::path::interpolate::Error::Missing { .. }) => Ok(None), + Err(err) => Err(err), + } + } +} diff --git a/gix/tests/repository/config/mod.rs b/gix/tests/repository/config/mod.rs index 056bc903546..227a7ed308e 100644 --- a/gix/tests/repository/config/mod.rs +++ b/gix/tests/repository/config/mod.rs @@ -38,7 +38,6 @@ mod ssh_options { #[cfg(any(feature = "blocking-network-client", feature = "async-network-client"))] mod transport_options; -#[cfg(feature = "blocking-network-client")] #[cfg(feature = "blocking-network-client")] pub fn repo(name: &str) -> gix::Repository { repo_opts(name, |opts| opts.strict_config(true))