[Bug]: clippy fails for FreeBSD with large_enum_variant in fsmon

Open Beginner friendly
#1,902 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
cli

Research direction

Read crates/fsmon/src/source.rs at the Opened enum around line 359. Reproduce the warning with cargo clippy --target x86_64-unknown-freebsd -p fsmon -- -D warnings using the FreeBSD target; Clippy identifies Unsupported(Metadata) as the oversized variant and suggests boxing the metadata. Done when that command passes and the other listed targets remain unaffected.

Written by the indexing model from the issue text.

Description

bug

Observed

cargo clippy --target x86_64-unknown-freebsd -p fsmon warns with clippy::large_enum_variant, and fails under -D warnings:

warning: large size difference between variants
   --> crates/fsmon/src/source.rs:359:1
    |
359 | / enum Opened {
360 | |     File(File),
362 | |     Special(Special),
    | |     ---------------- the second-largest variant contains at least 8 bytes
364 | |     Unsupported(Metadata),
    | |     --------------------- the largest variant contains at least 224 bytes
365 | | }
    | |_^ the entire enum is at least 232 bytes

On FreeBSD, std::fs::Metadata is much larger than on the other targets, so only this target trips the lint. macOS, Linux and Windows pass.

Reproduce

On develop, with the FreeBSD target installed (rustup target add x86_64-unknown-freebsd):

cargo clippy --target x86_64-unknown-freebsd -p fsmon -- -D warnings

Where

enum Opened at crates/fsmon/src/source.rs:359. Clippy suggests Unsupported(Box<Metadata>). CI doesn't run clippy for FreeBSD, so it doesn't catch this.

Found while working on #1890.

Dominant language
Rust
Stars
3.3k
Forks
67
Avg merge
3h 4m
Merged PRs (30d)
107

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pamburus/hl

All issues in pamburus/hl

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.