-
Notifications
You must be signed in to change notification settings - Fork 164
Closed
Description
Currently github check like https://github.com/mozilla/grcov/actions/runs/4345920963/jobs/7591298097
error: manual implementation of `Option::filter`
--> src/main.rs:479:14
|
479 | _ => match opt.output_path.as_deref() {
| ______________^
480 | | Some(output_path) => {
481 | | if output_path.is_dir() {
482 | | Some(output_path)
... |
487 | | _ => None,
488 | | },
| |_________^ help: try this: `opt.output_path.as_deref().filter(|&output_path| output_path.is_dir())`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_filter
= note: `-D clippy::manual-filter` implied by `-D warnings`
error: could not compile `grcov` due to previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `grcov` due to previous error
However the clippy suggestion with .filter(|&output_path| output_path.is_dir())
will not produce the desired result since currently
_ => match opt.output_path.as_deref() {
Some(output_path) => {
if output_path.is_dir() {
Some(output_path)
} else {
panic!("output_path must be a directory when using multiple outputs");
}
}
_ => None,
},
has else
code path need to generate a panic!()
if the output path is not a directory.
This clippy behaviour has been fixed on rust-lang/rust-clippy#10091 but unfortunately it's not yet released.
As a temporary work around we ignore the clippy warning by adding #[allow(clippy::manual_filter)]
to the code block.
This should be removed once the upstream fix to clippy is released
And remove TODO in Originally posted by @marco-c in #979 (comment)
Metadata
Metadata
Assignees
Labels
No labels