Skip to content

Commit

Permalink
thanks clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Apr 7, 2024
1 parent 25b3d23 commit 7f6bee5
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion gix-config/src/file/impls.rs
Expand Up @@ -42,7 +42,7 @@ impl<'a> TryFrom<&'a BStr> for File<'a> {

impl From<File<'_>> for BString {
fn from(c: File<'_>) -> Self {
c.into()
c.to_bstring()
}
}

Expand Down
2 changes: 1 addition & 1 deletion gix-config/src/parse/comment.rs
Expand Up @@ -39,7 +39,7 @@ impl Display for Comment<'_> {

impl From<Comment<'_>> for BString {
fn from(c: Comment<'_>) -> Self {
c.into()
c.to_bstring()
}
}

Expand Down
2 changes: 1 addition & 1 deletion gix-config/src/parse/event.rs
Expand Up @@ -72,7 +72,7 @@ impl Display for Event<'_> {

impl From<Event<'_>> for BString {
fn from(event: Event<'_>) -> Self {
event.into()
event.to_bstring()
}
}

Expand Down
2 changes: 1 addition & 1 deletion gix-config/src/parse/section/header.rs
Expand Up @@ -145,7 +145,7 @@ impl Display for Header<'_> {

impl From<Header<'_>> for BString {
fn from(header: Header<'_>) -> Self {
header.into()
header.to_bstring()
}
}

Expand Down
14 changes: 8 additions & 6 deletions gix-pack/src/cache/delta/from_offsets.rs
Expand Up @@ -57,12 +57,14 @@ impl<T> Tree<T> {
})?,
);

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)?;

{
Expand Down
14 changes: 0 additions & 14 deletions gix/src/config/cache/util.rs
Expand Up @@ -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;
}
Expand All @@ -154,16 +150,6 @@ impl<T, E> ApplyLeniency for Result<Option<T>, E> {
}
}

impl IgnoreEmptyPath for Result<Option<std::borrow::Cow<'_, std::path::Path>>, 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<T, E> ApplyLeniencyDefault for Result<T, E>
where
T: Default,
Expand Down
15 changes: 14 additions & 1 deletion gix/src/config/snapshot/credential_helpers.rs
Expand Up @@ -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,
},
Expand Down Expand Up @@ -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<Option<std::borrow::Cow<'_, std::path::Path>>, 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),
}
}
}
1 change: 0 additions & 1 deletion gix/tests/repository/config/mod.rs
Expand Up @@ -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))
Expand Down

0 comments on commit 7f6bee5

Please sign in to comment.