Skip to content

Commit 7f6bee5

Browse files
committed
thanks clippy
1 parent 25b3d23 commit 7f6bee5

File tree

8 files changed

+26
-26
lines changed

8 files changed

+26
-26
lines changed

gix-config/src/file/impls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<'a> TryFrom<&'a BStr> for File<'a> {
4242

4343
impl From<File<'_>> for BString {
4444
fn from(c: File<'_>) -> Self {
45-
c.into()
45+
c.to_bstring()
4646
}
4747
}
4848

gix-config/src/parse/comment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl Display for Comment<'_> {
3939

4040
impl From<Comment<'_>> for BString {
4141
fn from(c: Comment<'_>) -> Self {
42-
c.into()
42+
c.to_bstring()
4343
}
4444
}
4545

gix-config/src/parse/event.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl Display for Event<'_> {
7272

7373
impl From<Event<'_>> for BString {
7474
fn from(event: Event<'_>) -> Self {
75-
event.into()
75+
event.to_bstring()
7676
}
7777
}
7878

gix-config/src/parse/section/header.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl Display for Header<'_> {
145145

146146
impl From<Header<'_>> for BString {
147147
fn from(header: Header<'_>) -> Self {
148-
header.into()
148+
header.to_bstring()
149149
}
150150
}
151151

gix-pack/src/cache/delta/from_offsets.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,14 @@ impl<T> Tree<T> {
5757
})?,
5858
);
5959

60-
let anticipated_num_objects = if let Some(num_objects) = data_sorted_by_offsets.size_hint().1 {
61-
progress.init(Some(num_objects), progress::count("objects"));
62-
num_objects
63-
} else {
64-
0
65-
};
60+
let anticipated_num_objects = data_sorted_by_offsets
61+
.size_hint()
62+
.1
63+
.map(|num_objects| {
64+
progress.init(Some(num_objects), progress::count("objects"));
65+
num_objects
66+
})
67+
.unwrap_or_default();
6668
let mut tree = Tree::with_capacity(anticipated_num_objects)?;
6769

6870
{

gix/src/config/cache/util.rs

-14
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,6 @@ pub trait ApplyLeniency {
132132
fn with_leniency(self, is_lenient: bool) -> Self;
133133
}
134134

135-
pub trait IgnoreEmptyPath {
136-
fn ignore_empty(self) -> Self;
137-
}
138-
139135
pub trait ApplyLeniencyDefault {
140136
fn with_lenient_default(self, is_lenient: bool) -> Self;
141137
}
@@ -154,16 +150,6 @@ impl<T, E> ApplyLeniency for Result<Option<T>, E> {
154150
}
155151
}
156152

157-
impl IgnoreEmptyPath for Result<Option<std::borrow::Cow<'_, std::path::Path>>, gix_config::path::interpolate::Error> {
158-
fn ignore_empty(self) -> Self {
159-
match self {
160-
Ok(maybe_path) => Ok(maybe_path),
161-
Err(gix_config::path::interpolate::Error::Missing { .. }) => Ok(None),
162-
Err(err) => Err(err),
163-
}
164-
}
165-
}
166-
167153
impl<T, E> ApplyLeniencyDefault for Result<T, E>
168154
where
169155
T: Default,

gix/src/config/snapshot/credential_helpers.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use crate::config::cache::util::ApplyLeniency;
66
use crate::{
77
bstr::{ByteSlice, ByteVec},
88
config::{
9-
cache::util::IgnoreEmptyPath,
109
tree::{credential, gitoxide::Credentials, Core, Credential, Key},
1110
Snapshot,
1211
},
@@ -197,3 +196,17 @@ fn normalize(url: &mut gix_url::Url) {
197196
url.path.pop();
198197
}
199198
}
199+
200+
trait IgnoreEmptyPath {
201+
fn ignore_empty(self) -> Self;
202+
}
203+
204+
impl IgnoreEmptyPath for Result<Option<std::borrow::Cow<'_, std::path::Path>>, gix_config::path::interpolate::Error> {
205+
fn ignore_empty(self) -> Self {
206+
match self {
207+
Ok(maybe_path) => Ok(maybe_path),
208+
Err(gix_config::path::interpolate::Error::Missing { .. }) => Ok(None),
209+
Err(err) => Err(err),
210+
}
211+
}
212+
}

gix/tests/repository/config/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ mod ssh_options {
3838
#[cfg(any(feature = "blocking-network-client", feature = "async-network-client"))]
3939
mod transport_options;
4040

41-
#[cfg(feature = "blocking-network-client")]
4241
#[cfg(feature = "blocking-network-client")]
4342
pub fn repo(name: &str) -> gix::Repository {
4443
repo_opts(name, |opts| opts.strict_config(true))

0 commit comments

Comments
 (0)