fix: nightly clippy redundant else block lint - #13601
Conversation
Hi, @cakebaker we saw that when doing cargo clippy locally ```rust warning: redundant else block --> src/bin/coreutils.rs:140:6 | 140 | } else { | ______^ 141 | | // GNU just fails, but busybox tests needs usage 142 | | // todo: patch the test suite instead 143 | | if binary_as_util.ends_with("box") { ... | 148 | | process::exit(1); 149 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_else help: remove the `else` block and move the contents out | 140 ~ } 141 + // GNU just fails, but busybox tests needs usage 142 + // todo: patch the test suite instead 143 + if binary_as_util.ends_with("box") { 144 + usage(&utils, binary_as_util); 145 + } else { 146 + let _ = writeln!(io::stderr(), "coreutils: missing argument"); 147 + } 148 + process::exit(1); ```
|
Could you please add this in the ci too? |
|
we already have .github/workflows/code-quality.yml |
|
ah ok |
Merging this PR will regress 1 benchmark
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
|
@sylvestre i used cargo nightly that why, because new lints introduced |
|
@sylvestre can we add nightly tests too or no? |
|
ok, please revert the change then :) |
Ah, i misunderstond, so i need revoke only the run clippy script that change needs to be keeped
|
ok now done |
| validation::unrecognized_option(binary_as_util, &util_os); | ||
| } | ||
| process::exit(1); | ||
| validation::not_found(&util_os); |
There was a problem hiding this comment.
The change seems to be sound, but perhaps somewhat confusing as you now need to understand that validation::not_found etc exits the process to understand the control flow.
There was a problem hiding this comment.
yes you are right
There was a problem hiding this comment.
Actually not_found returns the never type, so the behaviour can be deduced from this.
xtqqczze
left a comment
There was a problem hiding this comment.
why has validation::not_found been removed?
|
ah ok, i will revert it |
|
GNU testsuite comparison: |
|
@cakebaker and @sylvestre can you merge that> |
Hi, @cakebaker
we saw that when doing cargo clippy locally