From 2b799273006754ea89bf3fb19eabf1328bd1f8dc Mon Sep 17 00:00:00 2001 From: Kivanc Date: Fri, 12 Dec 2025 15:41:31 +0300 Subject: [PATCH] Clippy suggestions implemented --- exercises/24_file_io/file_io3.rs | 3 ++- solutions/24_file_io/file_io3.rs | 8 ++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/exercises/24_file_io/file_io3.rs b/exercises/24_file_io/file_io3.rs index 6ac3be9b..7966bfcc 100644 --- a/exercises/24_file_io/file_io3.rs +++ b/exercises/24_file_io/file_io3.rs @@ -1,4 +1,5 @@ use std::fs; +use std::io::Error; use std::path::PathBuf; fn main() -> Result<(), std::io::Error> { @@ -33,7 +34,7 @@ fn create_required_files() -> Result<(), std::io::Error> { let dir_path = match file_path.parent(){ Some(parent) => parent, - None => return Err(std::io::Error::new(std::io::ErrorKind::Other, "Could not get parent path")), + None => return Err(Error::other("Could not get parent path")), }; if !dir_path.exists() { diff --git a/solutions/24_file_io/file_io3.rs b/solutions/24_file_io/file_io3.rs index ac65ca97..47a94325 100644 --- a/solutions/24_file_io/file_io3.rs +++ b/solutions/24_file_io/file_io3.rs @@ -1,4 +1,5 @@ use std::fs; +use std::io::Error; use std::path::PathBuf; fn main() -> Result<(), std::io::Error> { @@ -32,12 +33,7 @@ fn create_required_files() -> Result<(), std::io::Error> { let dir_path = match file_path.parent() { Some(parent) => parent, - None => { - return Err(std::io::Error::new( - std::io::ErrorKind::Other, - "Could not get parent path", - )); - } + None => return Err(Error::other("Could not get parent path")) }; if !dir_path.exists() {