@@ -4,27 +4,23 @@ mod input_manifest_builder;
44mod manifest_source;
55mod manifest_source_async;
66
7- use std:: io:: BufWriter ;
8-
97pub use input_manifest_builder:: InputManifestBuilder ;
108pub use manifest_source:: ManifestSource ;
119pub use manifest_source_async:: ManifestSourceAsync ;
1210
13- use crate :: { hash_algorithm:: Sha256 , IdentifyAsync } ;
14-
1511use {
1612 crate :: {
1713 artifact_id:: ArtifactId ,
1814 error:: InputManifestError ,
19- hash_algorithm:: HashAlgorithm ,
15+ hash_algorithm:: { HashAlgorithm , Sha256 } ,
2016 object_type:: { Blob , ObjectType } ,
2117 storage:: Storage ,
22- Identify ,
18+ Identify , IdentifyAsync ,
2319 } ,
2420 std:: {
2521 cmp:: Ordering ,
2622 fmt:: { Debug , Display , Formatter , Result as FmtResult } ,
27- io:: Write ,
23+ io:: { BufWriter , Write } ,
2824 } ,
2925} ;
3026
@@ -218,13 +214,15 @@ impl<H: HashAlgorithm> InputManifest<H> {
218214 write ! ( out, "{}" , self . header( ) ) ?;
219215
220216 for relation in & self . inputs {
221- write ! ( out, "{}" , relation. artifact. as_hex( ) ) ?;
222-
223- if let Some ( manifest_aid) = relation. manifest {
224- write ! ( out, " manifest {}" , manifest_aid. as_hex( ) ) ?;
217+ let target_hex = relation. artifact . as_hex ( ) ;
218+
219+ match relation. manifest {
220+ Some ( manifest_aid) => {
221+ let manifest_hex = manifest_aid. as_hex ( ) ;
222+ writeln ! ( out, "{target_hex} manifest {manifest_hex}" ) ?
223+ }
224+ None => writeln ! ( out, "{target_hex}" ) ?,
225225 }
226-
227- writeln ! ( out) ?;
228226 }
229227
230228 Ok ( ( ) )
@@ -242,7 +240,8 @@ impl<H: HashAlgorithm> Debug for InputManifest<H> {
242240
243241impl < H : HashAlgorithm > Display for InputManifest < H > {
244242 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> FmtResult {
245- let str = String :: from_utf8 ( self . as_bytes ( ) . to_vec ( ) ) . unwrap ( ) ;
243+ // PANIC SAFETY: Always guaranteed to be valid UTF-8.
244+ let str = String :: from_utf8 ( self . as_bytes ( ) ) . unwrap ( ) ;
246245 write ! ( f, "{str}" )
247246 }
248247}
0 commit comments