Skip to content

Conversation

@drinkcat
Copy link
Collaborator

@drinkcat drinkcat commented Jun 3, 2025

Recent cargo clippy prefers to use if let for single pattern.

For some reason it only triggers on one of the LANG restore case though, but we can just fix them all.

Not completely sure why cargo clippy only complains about this one:

error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
   --> src/uucore/src/lib/mods/locale.rs:767:9
    |
767 | /         match original_lang {
768 | |             Some(val) => unsafe {
769 | |                 env::set_var("LANG", val);
770 | |             },
771 | |             None => {} // Was already unset
772 | |         }
    | |_________^
    |
    = note: you might want to preserve the comments from inside the `match`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
    = note: `-D clippy::single-match` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::single_match)]`
help: try
    |
767 ~         if let Some(val) = original_lang { unsafe {
768 +             env::set_var("LANG", val);
769 +         } }
    |

@sylvestre FYI

Recent cargo clippy prefers to use if let for single pattern.

For some reason it only triggers on one of the LANG restore case though,
but we can just fix them all.
@cakebaker
Copy link
Contributor

clippy probably complains because the comment is outside the block.

@sylvestre sylvestre merged commit 28612fe into uutils:main Jun 3, 2025
73 of 74 checks passed
@drinkcat
Copy link
Collaborator Author

drinkcat commented Jun 3, 2025

clippy probably complains because the comment is outside the block.

You are correct! That would have fixed it too...

@drinkcat drinkcat deleted the local-lang-clippy branch June 3, 2025 08:10
@github-actions
Copy link

github-actions bot commented Jun 3, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants