Skip to content

Clippy flags filter_map(Result::ok) in fastq-filter as potentially infinite #268

@werner291

Description

@werner291

Hi - I did the clippy warnings PR on rust-bio, figured I'd do the same here.


While fixing clippy warnings I noticed this in src/fastq/filter.rs:44:

HashSet::<String>::from_iter(f.lines().filter_map(Result::ok).collect::<Vec<String>>());

Clippy warns that if the iterator keeps producing Err, this never terminates. It also means lines that fail to read are silently dropped, so the filter runs on a partial ID set.

If silently skipping bad lines is intentional (e.g. to handle malformed input files), a comment explaining that would help - in this case I strongly suggest logging a warning or error somewhere so the issue isn't silent. I left this out of my clippy PR since the fix changes error-handling behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions