Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,13 @@ 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)");
println!("cargo:rustc-check-cfg=cfg(no_unsafe_op_in_unsafe_fn_lint)");
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
Expand Down
2 changes: 0 additions & 2 deletions src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down
2 changes: 0 additions & 2 deletions src/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(),
}
}

Expand Down
6 changes: 1 addition & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ pub struct Comparator {
/// - &ensp;**`I.J.*`**&emsp;&mdash;&emsp;equivalent to `=I.J`
/// - &ensp;**`I.*`**&ensp;or&ensp;**`I.*.*`**&emsp;&mdash;&emsp;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,
Expand All @@ -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
Expand Down