Skip to content

Commit

Permalink
Delete Visibility::Crate and VisCrate
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jan 30, 2023
1 parent 8903d4d commit 0d2270e
Show file tree
Hide file tree
Showing 12 changed files with 2 additions and 68 deletions.
15 changes: 0 additions & 15 deletions src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -313,8 +310,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)
}
Expand Down Expand Up @@ -366,16 +361,6 @@ pub mod parsing {
Ok(Visibility::Public(VisPublic { pub_token }))
}

fn parse_crate(input: ParseStream) -> Result<Self> {
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 {
Expand Down
1 change: 0 additions & 1 deletion src/gen/clone.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/gen/debug.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/gen/eq.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/gen/fold.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions src/gen/hash.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions src/gen/visit.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions src/gen/visit_mut.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions syn.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions tests/debug/gen.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 0 additions & 19 deletions tests/test_derive_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
Expand Down
5 changes: 0 additions & 5 deletions tests/test_visibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 0d2270e

Please sign in to comment.