this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: use common fn for constructing errors

+7 -12
+7 -12
src/utils.rs
··· 64 64 65 65 /// Compress a Read trait object to a Write object. 66 66 fn compress<I: Read, O: Write>(&self, input: I, output: O) -> Result<(), io::Error> { 67 - Err(io::Error::new( 68 - io::ErrorKind::Other, 69 - "compress unimplemented", 70 - )) 67 + cmprss_error("compress unimplemented") 71 68 } 72 69 73 70 /// Extract a Read trait object to a Write object. 74 71 fn extract<I: Read, O: Write>(&self, input: I, output: O) -> Result<(), io::Error> { 75 - Err(io::Error::new( 76 - io::ErrorKind::Other, 77 - "extract unimplemented", 78 - )) 72 + cmprss_error("extract unimplemented") 79 73 } 80 74 81 75 /// Extract a Read trait object to a path. ··· 85 79 input: I, 86 80 out_path: O, 87 81 ) -> Result<(), io::Error> { 88 - Err(io::Error::new( 89 - io::ErrorKind::Other, 90 - "extract_to_path unimplemented", 91 - )) 82 + cmprss_error("extract_to_path unimplemented") 92 83 } 93 84 94 85 /// Extract a file to a path ··· 102 93 self.extract_to_path(File::open(input_file)?, out_directory) 103 94 } 104 95 } 96 + 97 + fn cmprss_error(message: &str) -> Result<(), io::Error> { 98 + Err(io::Error::new(io::ErrorKind::Other, message)) 99 + }