@@ -163,7 +163,7 @@ where
163163 } ;
164164
165165 print ! ( "{visualizer}" ) ; // visualizer already ends with "\n", println! isn't needed here.
166- Hook :: report_deduplication_results ( deduplication_record, bytes_format) ;
166+ Hook :: report_deduplication_results ( deduplication_record? , bytes_format) ? ;
167167 Ok ( ( ) )
168168 }
169169}
@@ -178,12 +178,12 @@ pub trait DeduplicateHardlinkSizes<Size: size::Size> {
178178 fn deduplicate_hardlink_sizes (
179179 data_tree : & mut DataTree < OsStringDisplay , Size > ,
180180 record : Self :: HardlinkRecord ,
181- ) -> Self :: DeduplicationReport ;
181+ ) -> Result < Self :: DeduplicationReport , RuntimeError > ;
182182 /// Handle the report.
183183 fn report_deduplication_results (
184184 report : Self :: DeduplicationReport ,
185185 bytes_format : Size :: DisplayFormat ,
186- ) ;
186+ ) -> Result < ( ) , RuntimeError > ;
187187}
188188
189189#[ cfg( unix) ]
@@ -198,7 +198,7 @@ where
198198 fn deduplicate_hardlink_sizes (
199199 data_tree : & mut DataTree < OsStringDisplay , Size > ,
200200 record : Self :: HardlinkRecord ,
201- ) -> Self :: DeduplicationReport {
201+ ) -> Result < Self :: DeduplicationReport , RuntimeError > {
202202 use std:: path:: { Path , PathBuf } ;
203203 let hardlink_info: Box < [ ( Size , Vec < PathBuf > ) ] > = record
204204 . iter ( )
@@ -209,13 +209,13 @@ where
209209 . map ( |( size, paths) | ( * size, paths. iter ( ) . map ( AsRef :: as_ref) . collect ( ) ) )
210210 . collect ( ) ;
211211 data_tree. par_deduplicate_hardlinks ( & hardlink_info) ;
212- record
212+ Ok ( record)
213213 }
214214
215215 fn report_deduplication_results (
216216 report : Self :: DeduplicationReport ,
217217 bytes_format : Size :: DisplayFormat ,
218- ) {
218+ ) -> Result < ( ) , RuntimeError > {
219219 let ( inodes, links, size) : ( usize , usize , Size ) = report
220220 . iter ( )
221221 . filter_map ( |ref_multi| {
@@ -234,6 +234,7 @@ where
234234 let size = size. display ( bytes_format) ;
235235 println ! ( "Detected {links} hardlinks for {inodes} unique files (total: {size})" ) ;
236236 }
237+ Ok ( ( ) )
237238 }
238239}
239240
@@ -244,10 +245,18 @@ where
244245{
245246 type HardlinkRecord = ( ) ;
246247 type DeduplicationReport = ( ) ;
248+
247249 fn deduplicate_hardlink_sizes (
248250 _: & mut DataTree < OsStringDisplay , Size > ,
249251 _: Self :: HardlinkRecord ,
250- ) -> Self :: DeduplicationReport {
252+ ) -> Result < Self :: DeduplicationReport , RuntimeError > {
253+ Ok ( ( ) )
254+ }
255+
256+ fn report_deduplication_results (
257+ ( ) : Self :: DeduplicationReport ,
258+ _: Size :: DisplayFormat ,
259+ ) -> Result < ( ) , RuntimeError > {
260+ Ok ( ( ) )
251261 }
252- fn report_deduplication_results ( ( ) : Self :: DeduplicationReport , _: Size :: DisplayFormat ) { }
253262}
0 commit comments