Skip to content

Commit 2b79927

Browse files
committed
Clippy suggestions implemented
1 parent 4d461e0 commit 2b79927

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

exercises/24_file_io/file_io3.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::fs;
2+
use std::io::Error;
23
use std::path::PathBuf;
34

45
fn main() -> Result<(), std::io::Error> {
@@ -33,7 +34,7 @@ fn create_required_files() -> Result<(), std::io::Error> {
3334

3435
let dir_path = match file_path.parent(){
3536
Some(parent) => parent,
36-
None => return Err(std::io::Error::new(std::io::ErrorKind::Other, "Could not get parent path")),
37+
None => return Err(Error::other("Could not get parent path")),
3738
};
3839

3940
if !dir_path.exists() {

solutions/24_file_io/file_io3.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::fs;
2+
use std::io::Error;
23
use std::path::PathBuf;
34

45
fn main() -> Result<(), std::io::Error> {
@@ -32,12 +33,7 @@ fn create_required_files() -> Result<(), std::io::Error> {
3233

3334
let dir_path = match file_path.parent() {
3435
Some(parent) => parent,
35-
None => {
36-
return Err(std::io::Error::new(
37-
std::io::ErrorKind::Other,
38-
"Could not get parent path",
39-
));
40-
}
36+
None => return Err(Error::other("Could not get parent path"))
4137
};
4238

4339
if !dir_path.exists() {

0 commit comments

Comments
 (0)