Skip to content

Commit 0981434

Browse files
fix: address clippy warnings
1 parent d8108d5 commit 0981434

6 files changed

Lines changed: 9 additions & 9 deletions

File tree

gix-protocol/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ fetch = [
5959
## If set, blocking server-side protocol implementations are available.
6060
blocking-server = [
6161
"gix-transport/blocking-server",
62-
"maybe-async/is_sync",
6362
"serve",
6463
]
6564
## Add implementations for serving (upload-pack).

gix-protocol/src/serve/ref_advertisement.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn write_v1<W: Write>(writer: &mut W, refs: &[RefAdvertisement<'_>], capabil
1818
})
1919
})
2020
.collect();
21-
all_caps.extend(capabilities.iter().map(|c| c.to_string()));
21+
all_caps.extend(capabilities.iter().map(ToString::to_string));
2222
let caps = all_caps.join(" ");
2323

2424
if refs.is_empty() {

gix-protocol/src/serve/upload_pack/function.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ pub fn serve_upload_pack_v1<R: Read, W: Write>(
3030
let wants = parse_wants(&mut connection.line_provider)?;
3131
if wants.wants.is_empty() {
3232
return Ok(());
33-
};
33+
}
34+
3435
connection.line_provider.reset();
3536

3637
let mut common = Vec::new();
@@ -59,7 +60,7 @@ pub fn serve_upload_pack_v1<R: Read, W: Write>(
5960
write_ack(&mut connection.writer, last, AckStatus::Final)?;
6061
} else {
6162
write_nak(&mut connection.writer)?;
62-
};
63+
}
6364

6465
let want_ids: Vec<ObjectId> = wants.wants.iter().map(|w| w.id).collect();
6566
generate_pack(&want_ids, &common, &mut connection.writer)?;

gix-protocol/src/serve/upload_pack/want_haves.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub fn parse_wants<R: Read>(reader: &mut StreamingPeekableIter<R>) -> Result<Wan
7272

7373
if is_first {
7474
if let Some(caps) = caps_str {
75-
capabilities = caps.split(|b| *b == b' ').map(|c| c.into()).collect();
75+
capabilities = caps.split(|b| *b == b' ').map(Into::into).collect();
7676
}
7777
is_first = false;
7878
}

gix-serve/src/serve.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use gix_protocol::serve::{
99
use gix_ref::file::Store;
1010
use gix_transport::{server::blocking_io::connection::Connection, Protocol};
1111

12-
use crate::{refs::collect_refs, AdvertisableRef};
12+
use crate::{pack::generate_pack, refs::collect_refs, AdvertisableRef};
1313

1414
impl AdvertisableRef {
1515
/// Borrow as a `RefAdvertisement` for the protocol layer.
@@ -18,7 +18,7 @@ impl AdvertisableRef {
1818
name: &self.name,
1919
object_id: &self.object_id,
2020
peeled: self.peeled.as_deref(),
21-
symref_target: self.symref_target.as_ref().map(|s| s.as_ref()),
21+
symref_target: self.symref_target.as_ref().map(AsRef::as_ref),
2222
}
2323
}
2424
}
@@ -48,7 +48,7 @@ pub fn serve_upload_pack<R: Read, W: Write, F: Find + Send + Clone + 'static>(
4848
let has_object = |oid: &oid| db.contains(oid);
4949

5050
let generate_pack = |wants: &[ObjectId], haves: &[ObjectId], out: &mut dyn Write| {
51-
crate::pack::generate_pack(db.clone(), wants, haves, out).map_err(|e| io::Error::new(io::ErrorKind::Other, e))
51+
generate_pack(db.clone(), wants, haves, out).map_err(io::Error::other)
5252
};
5353

5454
match protocol {

gix-serve/tests/upload_pack.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ fn v1_empty_wants() {
116116
serve_upload_pack(&store, db, &mut conn, Protocol::V1).unwrap();
117117

118118
assert!(!output.is_empty());
119-
assert!(output.windows(4).position(|w| w == b"PACK").is_none());
119+
assert!(!output.windows(4).any(|w| w == b"PACK"));
120120
}
121121

122122
#[test]

0 commit comments

Comments
 (0)