Skip to content

Commit 2eba5c2

Browse files
Drop needless rustversion dependency (#446)
lgtm 👍
1 parent f301b67 commit 2eba5c2

File tree

10 files changed

+2
-76
lines changed

10 files changed

+2
-76
lines changed

strum_macros/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ name = "strum_macros"
2323
heck = "0.5.0"
2424
proc-macro2 = "1.0"
2525
quote = "1.0"
26-
rustversion = "1.0"
2726
syn = { version = "2.0", features = ["parsing"] }
2827

2928
[dev-dependencies]

strum_macros/src/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -658,15 +658,10 @@ pub fn enum_table(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
658658
/// Three = 3,
659659
/// }
660660
///
661-
/// # #[rustversion::since(1.46)]
662661
/// const fn number_from_repr(d: u8) -> Option<Number> {
663662
/// Number::from_repr(d)
664663
/// }
665664
///
666-
/// # #[rustversion::before(1.46)]
667-
/// # fn number_from_repr(d: u8) -> Option<Number> {
668-
/// # Number::from_repr(d)
669-
/// # }
670665
/// assert_eq!(None, number_from_repr(0));
671666
/// assert_eq!(Some(Number::One), number_from_repr(1));
672667
/// assert_eq!(None, number_from_repr(2));

strum_macros/src/macros/from_repr.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,7 @@ pub fn from_repr_inner(ast: &DeriveInput) -> syn::Result<TokenStream> {
9797
let const_if_possible = if has_additional_data {
9898
quote! {}
9999
} else {
100-
#[rustversion::before(1.46)]
101-
fn filter_by_rust_version(_: TokenStream) -> TokenStream {
102-
quote! {}
103-
}
104-
105-
#[rustversion::since(1.46)]
106-
fn filter_by_rust_version(s: TokenStream) -> TokenStream {
107-
s
108-
}
109-
filter_by_rust_version(quote! { const })
100+
quote! { const }
110101
};
111102

112103
Ok(quote! {

strum_macros/src/macros/strings/from_string.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,6 @@ pub fn from_string_inner(ast: &DeriveInput) -> syn::Result<TokenStream> {
195195
})
196196
}
197197

198-
#[rustversion::before(1.34)]
199-
fn try_from_str(
200-
_name: &proc_macro2::Ident,
201-
_impl_generics: &syn::ImplGenerics,
202-
_ty_generics: &syn::TypeGenerics,
203-
_where_clause: Option<&syn::WhereClause>,
204-
_strum_module_path: &syn::Path,
205-
) -> TokenStream {
206-
Default::default()
207-
}
208-
209-
#[rustversion::since(1.34)]
210198
fn try_from_str(
211199
name: &proc_macro2::Ident,
212200
impl_generics: &syn::ImplGenerics,

strum_nostd_tests/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,3 @@ rust-version = "1.66.1"
77
[dependencies]
88
strum = { path = "../strum", features = ["derive"] }
99
strum_macros = { path = "../strum_macros", features = [] }
10-
11-
[dev-dependencies]
12-
rustversion = "1.0"

strum_nostd_tests/src/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,8 @@ mod tests {
2525
}
2626

2727
#[test]
28-
#[rustversion::since(1.34)]
2928
fn try_from_str_no_std() {
3029
use core::convert::TryFrom;
3130
assert_eq!(Color::Yellow, Color::try_from("yellow").unwrap());
3231
}
33-
34-
#[test]
35-
#[rustversion::before(1.34)]
36-
fn try_from_str_no_std() {}
3732
}

strum_tests/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,3 @@ strum_macros = { path = "../strum_macros", features = [] }
1515
clap = "=4.2.7"
1616
enum_variant_type = "=0.2.0"
1717
structopt = "=0.3.26"
18-
19-
[dev-dependencies]
20-
rustversion = "1.0"

strum_tests/tests/enum_discriminants.rs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ fn from_ref_test_complex() {
211211
}
212212

213213
#[allow(dead_code)]
214-
#[rustversion::since(1.34)]
215214
#[derive(Debug, Eq, PartialEq, EnumDiscriminants, EnumVariantType)]
216215
#[strum_discriminants(
217216
name(VariantFilterAttrDiscs),
@@ -225,8 +224,7 @@ enum VariantFilterAttr {
225224
BrightWhite(i32),
226225
}
227226

228-
#[rustversion::attr(since(1.34), test)]
229-
#[rustversion::since(1.34)]
227+
#[test]
230228
fn filter_variant_attributes_pass_through() {
231229
use std::str::FromStr;
232230

@@ -245,7 +243,6 @@ fn filter_variant_attributes_pass_through() {
245243
}
246244

247245
#[test]
248-
#[rustversion::since(1.34)]
249246
fn override_visibility() {
250247
mod private {
251248
use super::*;
@@ -265,27 +262,6 @@ fn override_visibility() {
265262
);
266263
}
267264

268-
#[test]
269-
#[rustversion::before(1.34)]
270-
fn override_visibility() {
271-
mod private {
272-
use super::*;
273-
274-
#[allow(dead_code)]
275-
#[derive(EnumDiscriminants)]
276-
#[strum_discriminants(name(PubDiscriminants), vis(r#pub))]
277-
enum PrivateEnum {
278-
VariantA(bool),
279-
VariantB(bool),
280-
}
281-
}
282-
283-
assert_ne!(
284-
private::PubDiscriminants::VariantA,
285-
private::PubDiscriminants::VariantB,
286-
);
287-
}
288-
289265
#[test]
290266
fn crate_module_path_test() {
291267
pub mod nested {

strum_tests/tests/from_repr.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ fn simple_test() {
2525
assert_eq!(Week::from_repr(9), None);
2626
}
2727

28-
#[rustversion::since(1.46)]
2928
#[test]
3029
fn const_test() {
3130
// This is to test that it works in a const fn

strum_tests/tests/from_str.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ enum Color2 {
3434
Purple { inner: String }
3535
}
3636

37-
#[rustversion::since(1.34)]
3837
fn assert_from_str<'a, T>(a: T, from: &'a str)
3938
where
4039
T: PartialEq + std::str::FromStr + std::convert::TryFrom<&'a str> + std::fmt::Debug,
@@ -45,15 +44,6 @@ where
4544
assert_eq!(a, std::convert::TryFrom::try_from(from).unwrap());
4645
}
4746

48-
#[rustversion::before(1.34)]
49-
fn assert_from_str<T>(a: T, from: &str)
50-
where
51-
T: PartialEq + std::str::FromStr + std::fmt::Debug,
52-
<T as std::str::FromStr>::Err: std::fmt::Debug,
53-
{
54-
assert_eq!(a, T::from_str(from).unwrap());
55-
}
56-
5747
#[test]
5848
fn color_simple() {
5949
assert_from_str(Color::Red, "Red");
@@ -183,7 +173,6 @@ fn case_insensitive_enum_no_case_insensitive() {
183173
assert!(CaseInsensitiveEnum::from_str("nocaseinsensitive").is_err());
184174
}
185175

186-
#[rustversion::since(1.34)]
187176
#[test]
188177
fn case_insensitive_enum_no_case_insensitive_try_from() {
189178
assert_from_str(CaseInsensitiveEnum::NoCaseInsensitive, "NoCaseInsensitive");

0 commit comments

Comments
 (0)