Skip to content

Commit 5c48671

Browse files
committed
Replaced the match and continue with an if let.
1 parent c4e17fd commit 5c48671

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

c2rust/src/main.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,20 @@ impl SubCommand {
4343
let entry = entry?;
4444
let file_type = entry.file_type()?;
4545
let path = entry.path();
46-
let name = match path.file_name()
46+
let name = path.file_name()
4747
.and_then(|name| name.to_str())
4848
.and_then(|name| name.strip_prefix(c2rust_name))
4949
.and_then(|name| name.strip_prefix('-'))
5050
.map(|name| name.to_owned())
5151
.map(Cow::from)
5252
.filter(|_| file_type.is_file() || file_type.is_symlink())
53-
.filter(|_| path.is_executable())
54-
{
55-
Some(name) => name,
56-
None => continue,
57-
};
58-
sub_commands.push(Self {
59-
path: Some(path),
60-
name,
61-
});
53+
.filter(|_| path.is_executable());
54+
if let Some(name) = name {
55+
sub_commands.push(Self {
56+
path: Some(path),
57+
name,
58+
});
59+
}
6260
}
6361
Ok(sub_commands)
6462
}

0 commit comments

Comments
 (0)