Skip to content

Commit 7fc4443

Browse files
committed
refactor(file): Be consistent in return paths
1 parent 2b5e330 commit 7fc4443

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/file/source/file.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ impl FileSourceFile {
3535

3636
// First check for an _exact_ match
3737
if filename.is_file() {
38-
return if let Some(format) = format_hint {
39-
Ok((filename, Box::new(format)))
38+
if let Some(format) = format_hint {
39+
return Ok((filename, Box::new(format)));
4040
} else {
4141
for (format, extensions) in all_extensions().iter() {
4242
if extensions.contains(
@@ -49,14 +49,13 @@ impl FileSourceFile {
4949
return Ok((filename, Box::new(*format)));
5050
}
5151
}
52-
53-
Err(Box::new(io::Error::new(
52+
return Err(Box::new(io::Error::new(
5453
io::ErrorKind::NotFound,
5554
format!(
5655
"configuration file \"{}\" is not of a registered file format",
5756
filename.to_string_lossy()
5857
),
59-
)))
58+
)));
6059
};
6160
}
6261

0 commit comments

Comments
 (0)