@@ -75,19 +75,12 @@ pub fn get_previous_image_path(output_name: &str) -> io::Result<(String, String)
7575
7676 let mut buf = Vec :: with_capacity ( 64 ) ;
7777 File :: open ( filepath) ?. read_to_end ( & mut buf) ?;
78- let buf = String :: from_utf8 ( buf) . map_err ( |e| {
79- std:: io:: Error :: new (
80- std:: io:: ErrorKind :: Other ,
81- format ! ( "failed to decode bytes: {e}" ) ,
82- )
83- } ) ?;
78+ let buf = String :: from_utf8 ( buf)
79+ . map_err ( |e| std:: io:: Error :: other ( format ! ( "failed to decode bytes: {e}" ) ) ) ?;
8480
8581 match buf. split_once ( "\n " ) {
8682 Some ( buf) => Ok ( ( buf. 0 . to_string ( ) , buf. 1 . to_string ( ) ) ) ,
87- None => Err ( std:: io:: Error :: new (
88- std:: io:: ErrorKind :: Other ,
89- "failed to read image filter" ,
90- ) ) ,
83+ None => Err ( std:: io:: Error :: other ( "failed to read image filter" ) ) ,
9184 }
9285}
9386
@@ -100,9 +93,8 @@ pub fn load(output_name: &str) -> io::Result<()> {
10093 if let Ok ( mut child) = std:: process:: Command :: new ( "pidof" ) . arg ( "swww" ) . spawn ( ) {
10194 if let Ok ( status) = child. wait ( ) {
10295 if status. success ( ) {
103- return Err ( std:: io:: Error :: new (
104- std:: io:: ErrorKind :: Other ,
105- "there is already another swww process running" . to_string ( ) ,
96+ return Err ( std:: io:: Error :: other (
97+ "there is already another swww process running" ,
10698 ) ) ;
10799 }
108100 }
@@ -181,9 +173,8 @@ fn cache_dir() -> io::Result<PathBuf> {
181173 create_dir ( & path) ?;
182174 Ok ( path)
183175 } else {
184- Err ( std:: io:: Error :: new (
185- std:: io:: ErrorKind :: Other ,
186- "failed to read both $XDG_CACHE_HOME and $HOME environment variables" . to_string ( ) ,
176+ Err ( std:: io:: Error :: other (
177+ "failed to read both $XDG_CACHE_HOME and $HOME environment variables" ,
187178 ) )
188179 }
189180}
0 commit comments