Skip to content

Fix TODO on clippy false positive warning #980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
edmundoferreira opened this issue Mar 9, 2023 · 0 comments · Fixed by #983
Closed

Fix TODO on clippy false positive warning #980

edmundoferreira opened this issue Mar 9, 2023 · 0 comments · Fixed by #983

Comments

@edmundoferreira
Copy link
Contributor

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)

edmundoferreira added a commit to edmundoferreira/grcov that referenced this issue Mar 9, 2023
marco-c pushed a commit that referenced this issue Mar 9, 2023
edmundoferreira added a commit to edmundoferreira/grcov that referenced this issue Mar 16, 2023
- fixed upstream and release on rust 1.6.8

Closes mozilla#980
edmundoferreira added a commit to edmundoferreira/grcov that referenced this issue Mar 16, 2023
- fix upstream and release on rust 1.6.8

Closes mozilla#980
marco-c pushed a commit that referenced this issue Mar 16, 2023
- fix upstream and release on rust 1.6.8

Closes #980
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 a pull request may close this issue.

1 participant