Skip to content

Commit 6e656fb

Browse files
waywardmonkeysalerque
authored andcommitted
refactor: Use flatten in sample
1 parent 5ebb389 commit 6e656fb

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

fluent-bundle/examples/simple-app.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,13 @@ fn get_available_locales() -> Result<Vec<LanguageIdentifier>, io::Error> {
5656
dir.push("examples");
5757
dir.push("resources");
5858
let res_dir = fs::read_dir(dir)?;
59-
for entry in res_dir {
60-
if let Ok(entry) = entry {
61-
let path = entry.path();
62-
if path.is_dir() {
63-
if let Some(name) = path.file_name() {
64-
if let Some(name) = name.to_str() {
65-
let langid = name.parse().expect("Parsing failed.");
66-
locales.push(langid);
67-
}
59+
for entry in res_dir.flatten() {
60+
let path = entry.path();
61+
if path.is_dir() {
62+
if let Some(name) = path.file_name() {
63+
if let Some(name) = name.to_str() {
64+
let langid = name.parse().expect("Parsing failed.");
65+
locales.push(langid);
6866
}
6967
}
7068
}

0 commit comments

Comments
 (0)