diff --git a/strum_macros/src/macros/enum_iter.rs b/strum_macros/src/macros/enum_iter.rs index d136d304..ce8237f8 100644 --- a/strum_macros/src/macros/enum_iter.rs +++ b/strum_macros/src/macros/enum_iter.rs @@ -80,8 +80,8 @@ pub fn enum_iter_inner(ast: &DeriveInput) -> syn::Result { marker: ::core::marker::PhantomData #phantom_data, } - impl #impl_generics core::fmt::Debug for #iter_name #ty_generics #where_clause { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + impl #impl_generics ::core::fmt::Debug for #iter_name #ty_generics #where_clause { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { // We don't know if the variants implement debug themselves so the only thing we // can really show is how many elements are left. f.debug_struct(#iter_name_debug_struct) diff --git a/strum_tests/tests/as_ref_no_strum.rs b/strum_tests/tests/as_ref_no_strum.rs index 82e3adc0..e8261f4a 100644 --- a/strum_tests/tests/as_ref_no_strum.rs +++ b/strum_tests/tests/as_ref_no_strum.rs @@ -1,5 +1,7 @@ use strum_macros::AsRefStr; +mod core {} // ensure macros call `::core` + #[derive(Debug, Eq, PartialEq, AsRefStr)] enum Color { #[strum(to_string = "RedRed")] diff --git a/strum_tests/tests/as_ref_str.rs b/strum_tests/tests/as_ref_str.rs index f6a43211..d492f174 100644 --- a/strum_tests/tests/as_ref_str.rs +++ b/strum_tests/tests/as_ref_str.rs @@ -3,6 +3,8 @@ use std::str::FromStr; use strum::{AsRefStr, AsStaticRef, AsStaticStr, EnumString, IntoStaticStr}; +mod core {} // ensure macros call `::core` + #[derive(Debug, Eq, PartialEq, EnumString, AsRefStr, AsStaticStr, IntoStaticStr)] enum Color { #[strum(to_string = "RedRed")] diff --git a/strum_tests/tests/display.rs b/strum_tests/tests/display.rs index 2e1b9968..4cec148e 100644 --- a/strum_tests/tests/display.rs +++ b/strum_tests/tests/display.rs @@ -1,5 +1,7 @@ use strum::{Display, EnumString}; +mod core {} // ensure macros call `::core` + #[derive(Debug, Eq, PartialEq, EnumString, Display)] enum Color { #[strum(to_string = "RedRed")] diff --git a/strum_tests/tests/enum_count.rs b/strum_tests/tests/enum_count.rs index db981106..3e24d633 100644 --- a/strum_tests/tests/enum_count.rs +++ b/strum_tests/tests/enum_count.rs @@ -1,5 +1,7 @@ use strum::{EnumCount, EnumIter, IntoEnumIterator}; +mod core {} // ensure macros call `::core` + #[derive(Debug, EnumCount, EnumIter)] enum Week { Sunday, diff --git a/strum_tests/tests/enum_discriminants.rs b/strum_tests/tests/enum_discriminants.rs index 9985f0e6..eb29e6d1 100644 --- a/strum_tests/tests/enum_discriminants.rs +++ b/strum_tests/tests/enum_discriminants.rs @@ -1,6 +1,9 @@ use enum_variant_type::EnumVariantType; use strum::{Display, EnumDiscriminants, EnumIter, EnumMessage, EnumString, IntoEnumIterator}; + +mod core {} // ensure macros call `::core` + #[allow(dead_code)] #[derive(Debug, Eq, PartialEq, EnumDiscriminants)] #[strum_discriminants(derive(EnumIter))] diff --git a/strum_tests/tests/enum_is.rs b/strum_tests/tests/enum_is.rs index 186cb23c..789881ce 100644 --- a/strum_tests/tests/enum_is.rs +++ b/strum_tests/tests/enum_is.rs @@ -1,5 +1,7 @@ use strum::EnumIs; +mod core {} // ensure macros call `::core` + #[derive(EnumIs)] enum Foo { Unit, diff --git a/strum_tests/tests/enum_iter.rs b/strum_tests/tests/enum_iter.rs index 7468267a..313ed5cf 100644 --- a/strum_tests/tests/enum_iter.rs +++ b/strum_tests/tests/enum_iter.rs @@ -1,5 +1,7 @@ use strum::{EnumIter, IntoEnumIterator}; +mod core {} // ensure macros call `::core` + #[derive(Debug, Eq, PartialEq, EnumIter)] enum Week { Sunday, diff --git a/strum_tests/tests/enum_message.rs b/strum_tests/tests/enum_message.rs index a5f7bde4..b1c86004 100644 --- a/strum_tests/tests/enum_message.rs +++ b/strum_tests/tests/enum_message.rs @@ -1,5 +1,7 @@ use strum::EnumMessage; +mod core {} // ensure macros call `::core` + #[derive(Debug, Eq, PartialEq, EnumMessage)] enum Pets { // This comment is not collected since it starts with "//" instead of "///". diff --git a/strum_tests/tests/enum_props.rs b/strum_tests/tests/enum_props.rs index 68fbb4d5..c32c07e0 100644 --- a/strum_tests/tests/enum_props.rs +++ b/strum_tests/tests/enum_props.rs @@ -1,5 +1,7 @@ use strum::EnumProperty; +mod core {} // ensure macros call `::core` + #[derive(Debug, EnumProperty)] enum Test { #[strum(props(key = "value"))] diff --git a/strum_tests/tests/enum_variant_names.rs b/strum_tests/tests/enum_variant_names.rs index f2ca98b6..afd8e4dd 100644 --- a/strum_tests/tests/enum_variant_names.rs +++ b/strum_tests/tests/enum_variant_names.rs @@ -1,6 +1,8 @@ use structopt::StructOpt; use strum::{EnumString, EnumVariantNames, VariantNames}; +mod core {} // ensure macros call `::core` + #[test] fn simple() { #[allow(dead_code)] diff --git a/strum_tests/tests/from_repr.rs b/strum_tests/tests/from_repr.rs index 403ac5ab..4e8f0ec8 100644 --- a/strum_tests/tests/from_repr.rs +++ b/strum_tests/tests/from_repr.rs @@ -1,5 +1,7 @@ use strum::FromRepr; +mod core {} // ensure macros call `::core` + #[derive(Debug, FromRepr, PartialEq)] /// Day of the week #[repr(u8)] diff --git a/strum_tests/tests/from_str.rs b/strum_tests/tests/from_str.rs index 845768cc..fd711945 100644 --- a/strum_tests/tests/from_str.rs +++ b/strum_tests/tests/from_str.rs @@ -1,6 +1,8 @@ use std::str::FromStr; use strum::EnumString; +mod core {} // ensure macros call `::core` + #[derive(Debug, Eq, PartialEq, EnumString)] enum Color { Red, diff --git a/strum_tests/tests/phf.rs b/strum_tests/tests/phf.rs index 163418e8..da2a8545 100644 --- a/strum_tests/tests/phf.rs +++ b/strum_tests/tests/phf.rs @@ -1,3 +1,5 @@ +mod core {} // ensure macros call `::core` + #[cfg(feature = "test_phf")] #[test] fn from_str_with_phf() { diff --git a/strum_tests/tests/serialize_all.rs b/strum_tests/tests/serialize_all.rs index b754816d..5798fa64 100644 --- a/strum_tests/tests/serialize_all.rs +++ b/strum_tests/tests/serialize_all.rs @@ -3,6 +3,8 @@ use std::str::FromStr; use std::string::ToString; use strum::{Display, EnumString, IntoStaticStr}; +mod core {} // ensure macros call `::core` + #[derive(Debug, Eq, PartialEq, EnumString, Display, IntoStaticStr)] #[strum(serialize_all = "title_case")] enum Foo1 { diff --git a/strum_tests/tests/to_string.rs b/strum_tests/tests/to_string.rs index 91538fc5..c3c29730 100644 --- a/strum_tests/tests/to_string.rs +++ b/strum_tests/tests/to_string.rs @@ -4,6 +4,8 @@ use std::str::FromStr; use std::string::ToString; use strum::{EnumString, ToString}; +mod core {} // ensure macros call `::core` + #[derive(Debug, Eq, PartialEq, EnumString, ToString)] enum Color { #[strum(to_string = "RedRed")]