diff --git a/build.rs b/build.rs index 4c5c5f96..38a6d9fa 100644 --- a/build.rs +++ b/build.rs @@ -11,7 +11,6 @@ fn main() { }; if compiler >= 80 { - println!("cargo:rustc-check-cfg=cfg(no_non_exhaustive)"); println!("cargo:rustc-check-cfg=cfg(no_nonzero_bitscan)"); println!("cargo:rustc-check-cfg=cfg(no_str_strip_prefix)"); println!("cargo:rustc-check-cfg=cfg(no_track_caller)"); @@ -19,12 +18,6 @@ fn main() { println!("cargo:rustc-check-cfg=cfg(test_node_semver)"); } - if compiler < 40 { - // #[non_exhaustive]. - // https://blog.rust-lang.org/2019/12/19/Rust-1.40.0.html#non_exhaustive-structs-enums-and-variants - println!("cargo:rustc-cfg=no_non_exhaustive"); - } - if compiler < 45 { // String::strip_prefix. // https://doc.rust-lang.org/std/primitive.str.html#method.strip_prefix diff --git a/src/display.rs b/src/display.rs index 3c2871bb..cbf5f302 100644 --- a/src/display.rs +++ b/src/display.rs @@ -56,8 +56,6 @@ impl Display for Comparator { Op::Tilde => "~", Op::Caret => "^", Op::Wildcard => "", - #[cfg(no_non_exhaustive)] - Op::__NonExhaustive => unreachable!(), }; formatter.write_str(op)?; write!(formatter, "{}", self.major)?; diff --git a/src/eval.rs b/src/eval.rs index e6e38949..270c6939 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -36,8 +36,6 @@ fn matches_impl(cmp: &Comparator, ver: &Version) -> bool { Op::LessEq => matches_exact(cmp, ver) || matches_less(cmp, ver), Op::Tilde => matches_tilde(cmp, ver), Op::Caret => matches_caret(cmp, ver), - #[cfg(no_non_exhaustive)] - Op::__NonExhaustive => unreachable!(), } } diff --git a/src/lib.rs b/src/lib.rs index 26081a13..d07d2fde 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -250,7 +250,7 @@ pub struct Comparator { /// -  **`I.J.*`** — equivalent to `=I.J` /// -  **`I.*`** or **`I.*.*`** — equivalent to `=I` #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] -#[cfg_attr(not(no_non_exhaustive), non_exhaustive)] +#[non_exhaustive] pub enum Op { Exact, Greater, @@ -260,10 +260,6 @@ pub enum Op { Tilde, Caret, Wildcard, - - #[cfg(no_non_exhaustive)] // rustc <1.40 - #[doc(hidden)] - __NonExhaustive, } /// Optional pre-release identifier on a version string. This comes after `-` in