Skip to content

Commit 09b3633

Browse files
committed
fix!: use dyn trait where possible.
This reduces compile time due to avoiding duplication.
1 parent 61d4c9f commit 09b3633

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

gix-actor/src/identity.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ mod write {
3535
/// Output
3636
impl Identity {
3737
/// Serialize this instance to `out` in the git serialization format for signatures (but without timestamp).
38-
pub fn write_to(&self, out: impl std::io::Write) -> std::io::Result<()> {
38+
pub fn write_to(&self, out: &mut dyn std::io::Write) -> std::io::Result<()> {
3939
self.to_ref().write_to(out)
4040
}
4141
}
4242

4343
impl<'a> IdentityRef<'a> {
4444
/// Serialize this instance to `out` in the git serialization format for signatures (but without timestamp).
45-
pub fn write_to(&self, mut out: impl std::io::Write) -> std::io::Result<()> {
45+
pub fn write_to(&self, out: &mut dyn std::io::Write) -> std::io::Result<()> {
4646
out.write_all(validated_token(self.name)?)?;
4747
out.write_all(b" ")?;
4848
out.write_all(b"<")?;

gix-actor/src/signature/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub(crate) mod write {
9595
/// Output
9696
impl Signature {
9797
/// Serialize this instance to `out` in the git serialization format for actors.
98-
pub fn write_to(&self, out: impl std::io::Write) -> std::io::Result<()> {
98+
pub fn write_to(&self, out: &mut dyn std::io::Write) -> std::io::Result<()> {
9999
self.to_ref().write_to(out)
100100
}
101101
/// Computes the number of bytes necessary to serialize this signature
@@ -106,7 +106,7 @@ pub(crate) mod write {
106106

107107
impl<'a> SignatureRef<'a> {
108108
/// Serialize this instance to `out` in the git serialization format for actors.
109-
pub fn write_to(&self, mut out: impl std::io::Write) -> std::io::Result<()> {
109+
pub fn write_to(&self, out: &mut dyn std::io::Write) -> std::io::Result<()> {
110110
out.write_all(validated_token(self.name)?)?;
111111
out.write_all(b" ")?;
112112
out.write_all(b"<")?;

gix-actor/tests/signature/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mod write_to {
1111
time: default_time(),
1212
};
1313
assert_eq!(
14-
format!("{:?}", signature.write_to(Vec::new())),
14+
format!("{:?}", signature.write_to(&mut Vec::new())),
1515
"Err(Custom { kind: Other, error: IllegalCharacter })"
1616
);
1717
}
@@ -24,7 +24,7 @@ mod write_to {
2424
time: default_time(),
2525
};
2626
assert_eq!(
27-
format!("{:?}", signature.write_to(Vec::new())),
27+
format!("{:?}", signature.write_to(&mut Vec::new())),
2828
"Err(Custom { kind: Other, error: IllegalCharacter })"
2929
);
3030
}
@@ -37,7 +37,7 @@ mod write_to {
3737
time: default_time(),
3838
};
3939
assert_eq!(
40-
format!("{:?}", signature.write_to(Vec::new())),
40+
format!("{:?}", signature.write_to(&mut Vec::new())),
4141
"Err(Custom { kind: Other, error: IllegalCharacter })"
4242
);
4343
}

0 commit comments

Comments
 (0)