Skip to content
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

non-exhaustive patterns: type &FileFormat is non-empty #308

Closed
omid opened this issue Mar 31, 2022 · 1 comment · Fixed by #309
Closed

non-exhaustive patterns: type &FileFormat is non-empty #308

omid opened this issue Mar 31, 2022 · 1 comment · Fixed by #309
Labels

Comments

@omid
Copy link

omid commented Mar 31, 2022

Hello,

After 0.12, when I disable default features, config fails with the following error.

For example, for this example, we don't need any feature to be enabled.

error[E0004]: non-exhaustive patterns: type `&FileFormat` is non-empty
   --> config-rs-753d70ca56f8adb9/7cf33db/src/file/format/mod.rs:101:15
    |
34  | / pub enum FileFormat {
35  | |     /// TOML (parsed with toml)
36  | |     #[cfg(feature = "toml")]
37  | |     Toml,
...   |
57  | |     Json5,
58  | | }
    | |_- `FileFormat` defined here
...
101 |           match self {
    |                 ^^^^
    |
    = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
    = note: the matched value is of type `&FileFormat`
    = note: references are always considered inhabited

For more information about this error, try `rustc --explain E0004`.

I think adding a _ => unreachable!() to the match can do the job.

@matthiasbeyer
Copy link
Member

Hey, thanks for this good catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants