diff --git a/src/data.rs b/src/data.rs index 39023d000d..5feacca1da 100644 --- a/src/data.rs +++ b/src/data.rs @@ -169,9 +169,6 @@ ast_enum_of_structs! { /// A public visibility level: `pub`. Public(VisPublic), - /// A crate-level visibility: `crate`. - Crate(VisCrate), - /// A visibility level restricted to some path: `pub(self)` or /// `pub(super)` or `pub(crate)` or `pub(in some::module)`. Restricted(VisRestricted), @@ -189,14 +186,6 @@ ast_struct! { } } -ast_struct! { - /// A crate-level visibility: `crate`. - #[cfg_attr(doc_cfg, doc(cfg(any(feature = "full", feature = "derive"))))] - pub struct VisCrate { - pub crate_token: Token![crate], - } -} - ast_struct! { /// A visibility level restricted to some path: `pub(self)` or /// `pub(super)` or `pub(crate)` or `pub(in some::module)`. @@ -313,8 +302,6 @@ pub mod parsing { if input.peek(Token![pub]) { Self::parse_pub(input) - } else if input.peek(Token![crate]) { - Self::parse_crate(input) } else { Ok(Visibility::Inherited) } @@ -366,16 +353,6 @@ pub mod parsing { Ok(Visibility::Public(VisPublic { pub_token })) } - fn parse_crate(input: ParseStream) -> Result { - if input.peek2(Token![::]) { - Ok(Visibility::Inherited) - } else { - Ok(Visibility::Crate(VisCrate { - crate_token: input.parse()?, - })) - } - } - #[cfg(feature = "full")] pub(crate) fn is_some(&self) -> bool { match self { @@ -444,13 +421,6 @@ mod printing { } } - #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] - impl ToTokens for VisCrate { - fn to_tokens(&self, tokens: &mut TokenStream) { - self.crate_token.to_tokens(tokens); - } - } - #[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] impl ToTokens for VisRestricted { fn to_tokens(&self, tokens: &mut TokenStream) { diff --git a/src/gen/clone.rs b/src/gen/clone.rs index e752b4d3ae..7428e7c091 100644 --- a/src/gen/clone.rs +++ b/src/gen/clone.rs @@ -2111,15 +2111,6 @@ impl Clone for Variant { } #[cfg(any(feature = "derive", feature = "full"))] #[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))] -impl Clone for VisCrate { - fn clone(&self) -> Self { - VisCrate { - crate_token: self.crate_token.clone(), - } - } -} -#[cfg(any(feature = "derive", feature = "full"))] -#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))] impl Clone for VisPublic { fn clone(&self) -> Self { VisPublic { @@ -2145,7 +2136,6 @@ impl Clone for Visibility { fn clone(&self) -> Self { match self { Visibility::Public(v0) => Visibility::Public(v0.clone()), - Visibility::Crate(v0) => Visibility::Crate(v0.clone()), Visibility::Restricted(v0) => Visibility::Restricted(v0.clone()), Visibility::Inherited => Visibility::Inherited, } diff --git a/src/gen/debug.rs b/src/gen/debug.rs index cd703813a9..a1e8b850e1 100644 --- a/src/gen/debug.rs +++ b/src/gen/debug.rs @@ -2876,15 +2876,6 @@ impl Debug for Variant { } #[cfg(any(feature = "derive", feature = "full"))] #[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))] -impl Debug for VisCrate { - fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let mut formatter = formatter.debug_struct("VisCrate"); - formatter.field("crate_token", &self.crate_token); - formatter.finish() - } -} -#[cfg(any(feature = "derive", feature = "full"))] -#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))] impl Debug for VisPublic { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { let mut formatter = formatter.debug_struct("VisPublic"); @@ -2914,11 +2905,6 @@ impl Debug for Visibility { formatter.field(v0); formatter.finish() } - Visibility::Crate(v0) => { - let mut formatter = formatter.debug_tuple("Crate"); - formatter.field(v0); - formatter.finish() - } Visibility::Restricted(v0) => { let mut formatter = formatter.debug_tuple("Restricted"); formatter.field(v0); diff --git a/src/gen/eq.rs b/src/gen/eq.rs index cb6664fcef..b2648a1e5e 100644 --- a/src/gen/eq.rs +++ b/src/gen/eq.rs @@ -2059,16 +2059,6 @@ impl PartialEq for Variant { } #[cfg(any(feature = "derive", feature = "full"))] #[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))] -impl Eq for VisCrate {} -#[cfg(any(feature = "derive", feature = "full"))] -#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))] -impl PartialEq for VisCrate { - fn eq(&self, _other: &Self) -> bool { - true - } -} -#[cfg(any(feature = "derive", feature = "full"))] -#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))] impl Eq for VisPublic {} #[cfg(any(feature = "derive", feature = "full"))] #[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))] @@ -2096,7 +2086,6 @@ impl PartialEq for Visibility { fn eq(&self, other: &Self) -> bool { match (self, other) { (Visibility::Public(self0), Visibility::Public(other0)) => self0 == other0, - (Visibility::Crate(self0), Visibility::Crate(other0)) => self0 == other0, (Visibility::Restricted(self0), Visibility::Restricted(other0)) => { self0 == other0 } diff --git a/src/gen/fold.rs b/src/gen/fold.rs index 0ff3651791..5c05d289b3 100644 --- a/src/gen/fold.rs +++ b/src/gen/fold.rs @@ -726,10 +726,6 @@ pub trait Fold { fold_variant(self, i) } #[cfg(any(feature = "derive", feature = "full"))] - fn fold_vis_crate(&mut self, i: VisCrate) -> VisCrate { - fold_vis_crate(self, i) - } - #[cfg(any(feature = "derive", feature = "full"))] fn fold_vis_public(&mut self, i: VisPublic) -> VisPublic { fold_vis_public(self, i) } @@ -3169,15 +3165,6 @@ where } } #[cfg(any(feature = "derive", feature = "full"))] -pub fn fold_vis_crate(f: &mut F, node: VisCrate) -> VisCrate -where - F: Fold + ?Sized, -{ - VisCrate { - crate_token: Token![crate](tokens_helper(f, &node.crate_token.span)), - } -} -#[cfg(any(feature = "derive", feature = "full"))] pub fn fold_vis_public(f: &mut F, node: VisPublic) -> VisPublic where F: Fold + ?Sized, @@ -3207,7 +3194,6 @@ where Visibility::Public(_binding_0) => { Visibility::Public(f.fold_vis_public(_binding_0)) } - Visibility::Crate(_binding_0) => Visibility::Crate(f.fold_vis_crate(_binding_0)), Visibility::Restricted(_binding_0) => { Visibility::Restricted(f.fold_vis_restricted(_binding_0)) } diff --git a/src/gen/hash.rs b/src/gen/hash.rs index d1881f5aa2..dd74d4877f 100644 --- a/src/gen/hash.rs +++ b/src/gen/hash.rs @@ -2703,14 +2703,6 @@ impl Hash for Variant { } #[cfg(any(feature = "derive", feature = "full"))] #[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))] -impl Hash for VisCrate { - fn hash(&self, _state: &mut H) - where - H: Hasher, - {} -} -#[cfg(any(feature = "derive", feature = "full"))] -#[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))] impl Hash for VisPublic { fn hash(&self, _state: &mut H) where @@ -2740,16 +2732,12 @@ impl Hash for Visibility { state.write_u8(0u8); v0.hash(state); } - Visibility::Crate(v0) => { - state.write_u8(1u8); - v0.hash(state); - } Visibility::Restricted(v0) => { - state.write_u8(2u8); + state.write_u8(1u8); v0.hash(state); } Visibility::Inherited => { - state.write_u8(3u8); + state.write_u8(2u8); } } } diff --git a/src/gen/visit.rs b/src/gen/visit.rs index bcdd937093..9047c2eeb1 100644 --- a/src/gen/visit.rs +++ b/src/gen/visit.rs @@ -725,10 +725,6 @@ pub trait Visit<'ast> { visit_variant(self, i); } #[cfg(any(feature = "derive", feature = "full"))] - fn visit_vis_crate(&mut self, i: &'ast VisCrate) { - visit_vis_crate(self, i); - } - #[cfg(any(feature = "derive", feature = "full"))] fn visit_vis_public(&mut self, i: &'ast VisPublic) { visit_vis_public(self, i); } @@ -3625,13 +3621,6 @@ where } } #[cfg(any(feature = "derive", feature = "full"))] -pub fn visit_vis_crate<'ast, V>(v: &mut V, node: &'ast VisCrate) -where - V: Visit<'ast> + ?Sized, -{ - tokens_helper(v, &node.crate_token.span); -} -#[cfg(any(feature = "derive", feature = "full"))] pub fn visit_vis_public<'ast, V>(v: &mut V, node: &'ast VisPublic) where V: Visit<'ast> + ?Sized, @@ -3659,9 +3648,6 @@ where Visibility::Public(_binding_0) => { v.visit_vis_public(_binding_0); } - Visibility::Crate(_binding_0) => { - v.visit_vis_crate(_binding_0); - } Visibility::Restricted(_binding_0) => { v.visit_vis_restricted(_binding_0); } diff --git a/src/gen/visit_mut.rs b/src/gen/visit_mut.rs index 9a9c2b2bbc..9b6918ade3 100644 --- a/src/gen/visit_mut.rs +++ b/src/gen/visit_mut.rs @@ -726,10 +726,6 @@ pub trait VisitMut { visit_variant_mut(self, i); } #[cfg(any(feature = "derive", feature = "full"))] - fn visit_vis_crate_mut(&mut self, i: &mut VisCrate) { - visit_vis_crate_mut(self, i); - } - #[cfg(any(feature = "derive", feature = "full"))] fn visit_vis_public_mut(&mut self, i: &mut VisPublic) { visit_vis_public_mut(self, i); } @@ -3628,13 +3624,6 @@ where } } #[cfg(any(feature = "derive", feature = "full"))] -pub fn visit_vis_crate_mut(v: &mut V, node: &mut VisCrate) -where - V: VisitMut + ?Sized, -{ - tokens_helper(v, &mut node.crate_token.span); -} -#[cfg(any(feature = "derive", feature = "full"))] pub fn visit_vis_public_mut(v: &mut V, node: &mut VisPublic) where V: VisitMut + ?Sized, @@ -3662,9 +3651,6 @@ where Visibility::Public(_binding_0) => { v.visit_vis_public_mut(_binding_0); } - Visibility::Crate(_binding_0) => { - v.visit_vis_crate_mut(_binding_0); - } Visibility::Restricted(_binding_0) => { v.visit_vis_restricted_mut(_binding_0); } diff --git a/src/lib.rs b/src/lib.rs index 115e57d697..88139667c2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -328,8 +328,7 @@ mod custom_punctuation; mod data; #[cfg(any(feature = "full", feature = "derive"))] pub use crate::data::{ - Field, Fields, FieldsNamed, FieldsUnnamed, Variant, VisCrate, VisPublic, VisRestricted, - Visibility, + Field, Fields, FieldsNamed, FieldsUnnamed, Variant, VisPublic, VisRestricted, Visibility, }; #[cfg(any(feature = "full", feature = "derive"))] diff --git a/syn.json b/syn.json index d46b3ed6de..49401aaa6f 100644 --- a/syn.json +++ b/syn.json @@ -5289,20 +5289,6 @@ } } }, - { - "ident": "VisCrate", - "features": { - "any": [ - "derive", - "full" - ] - }, - "fields": { - "crate_token": { - "token": "Crate" - } - } - }, { "ident": "VisPublic", "features": { @@ -5358,11 +5344,6 @@ "syn": "VisPublic" } ], - "Crate": [ - { - "syn": "VisCrate" - } - ], "Restricted": [ { "syn": "VisRestricted" diff --git a/tests/debug/gen.rs b/tests/debug/gen.rs index 3af6f33f12..b44b688754 100644 --- a/tests/debug/gen.rs +++ b/tests/debug/gen.rs @@ -5732,13 +5732,6 @@ impl Debug for Lite { formatter.finish() } } -impl Debug for Lite { - fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - let _val = &self.value; - let mut formatter = formatter.debug_struct("VisCrate"); - formatter.finish() - } -} impl Debug for Lite { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { let _val = &self.value; @@ -5774,10 +5767,6 @@ impl Debug for Lite { let mut formatter = formatter.debug_struct("Visibility::Public"); formatter.finish() } - syn::Visibility::Crate(_val) => { - let mut formatter = formatter.debug_struct("Visibility::Crate"); - formatter.finish() - } syn::Visibility::Restricted(_val) => { let mut formatter = formatter.debug_struct("Visibility::Restricted"); if let Some(val) = &_val.in_token { diff --git a/tests/test_derive_input.rs b/tests/test_derive_input.rs index db40f86236..38e2098af8 100644 --- a/tests/test_derive_input.rs +++ b/tests/test_derive_input.rs @@ -469,25 +469,6 @@ fn test_pub_restricted() { "###); } -#[test] -fn test_vis_crate() { - let input = quote! { - crate struct S; - }; - - snapshot!(input as DeriveInput, @r###" - DeriveInput { - vis: Visibility::Crate, - ident: "S", - generics: Generics, - data: Data::Struct { - fields: Unit, - semi_token: Some, - }, - } - "###); -} - #[test] fn test_pub_restricted_crate() { let input = quote! { diff --git a/tests/test_visibility.rs b/tests/test_visibility.rs index dcce23e083..7779e52b69 100644 --- a/tests/test_visibility.rs +++ b/tests/test_visibility.rs @@ -51,11 +51,6 @@ fn test_pub() { assert_vis_parse!("pub", Ok(Visibility::Public(_))); } -#[test] -fn test_crate() { - assert_vis_parse!("crate", Ok(Visibility::Crate(_))); -} - #[test] fn test_inherited() { assert_vis_parse!("", Ok(Visibility::Inherited));