Skip to content

Commit d5e84b4

Browse files
oech3cakebaker
authored andcommitted
uniq: remove a collapsible_if
1 parent fbefc2b commit d5e84b4

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

src/uu/uniq/src/uniq.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,11 @@ impl Uniq {
187187
}
188188

189189
fn is_c_locale() -> bool {
190-
for key in ["LC_ALL", "LC_CTYPE", "LANG"] {
191-
if let Some(v) = std::env::var_os(key) {
192-
if !v.is_empty() {
193-
return v == "C" || v == "POSIX";
194-
}
195-
}
196-
}
197-
true
190+
["LC_ALL", "LC_CTYPE", "LANG"]
191+
.iter()
192+
.find_map(|&key| std::env::var_os(key))
193+
.filter(|v| !v.is_empty())
194+
.is_none_or(|v| v == "C" || v == "POSIX")
198195
}
199196

200197
fn key_end_index(&self, line: &[u8], key_start: usize) -> usize {

0 commit comments

Comments
 (0)