Skip to content

Commit

Permalink
Revert "List peekable token types in documentation of Peek trait"
Browse files Browse the repository at this point in the history
This reverts commit 0c90291.
  • Loading branch information
dtolnay committed Jun 20, 2024
1 parent 2955706 commit 666e15e
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 52 deletions.
4 changes: 2 additions & 2 deletions src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::buffer::Cursor;
use crate::error::Result;
use crate::parse::ParseStream;
use crate::parse::Peek;
use crate::sealed::lookahead;
use crate::token::CustomToken;
use proc_macro2::Ident;

Expand Down Expand Up @@ -114,8 +115,7 @@ impl CustomToken for private::IdentAny {
}
}

#[cfg(not(docsrs))]
impl crate::sealed::lookahead::Sealed for private::PeekFn {}
impl lookahead::Sealed for private::PeekFn {}

mod private {
use proc_macro2::Ident;
Expand Down
7 changes: 0 additions & 7 deletions src/ident.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#[cfg(feature = "parsing")]
use crate::lookahead;
#[cfg(all(feature = "parsing", docsrs))]
use crate::lookahead::Peek;

pub use proc_macro2::Ident;

Expand All @@ -14,11 +12,6 @@ pub_if_not_doc! {
}
}

#[cfg(all(feature = "parsing", docsrs))]
impl Peek for Ident {
type Token = Self;
}

macro_rules! ident_from_token {
($token:ident) => {
impl From<Token![$token]> for Ident {
Expand Down
5 changes: 0 additions & 5 deletions src/lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,6 @@ pub_if_not_doc! {
}
}

#[cfg(all(feature = "parsing", docsrs))]
impl lookahead::Peek for Lifetime {
type Token = Self;
}

#[cfg(feature = "parsing")]
pub(crate) mod parsing {
use crate::error::Result;
Expand Down
15 changes: 0 additions & 15 deletions src/lit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -807,11 +807,6 @@ macro_rules! lit_extra_traits {
match marker {}
}
}

#[cfg(all(feature = "parsing", docsrs))]
impl lookahead::Peek for $ty {
type Token = Self;
}
};
}

Expand All @@ -832,11 +827,6 @@ pub_if_not_doc! {
}
}

#[cfg(all(feature = "parsing", docsrs))]
impl lookahead::Peek for LitBool {
type Token = Self;
}

/// The style of a string literal, either plain quoted or a raw string like
/// `r##"data"##`.
#[doc(hidden)] // https://github.com/dtolnay/syn/issues/1566
Expand All @@ -858,11 +848,6 @@ pub_if_not_doc! {
}
}

#[cfg(all(feature = "parsing", docsrs))]
impl lookahead::Peek for Lit {
type Token = Self;
}

#[cfg(feature = "parsing")]
pub(crate) mod parsing {
use crate::buffer::Cursor;
Expand Down
1 change: 0 additions & 1 deletion src/lookahead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,4 @@ impl<S> IntoSpans<S> for TokenMarker {
}
}

#[cfg(not(docsrs))]
impl<F: Copy + FnOnce(TokenMarker) -> T, T: Token> Sealed for F {}
7 changes: 0 additions & 7 deletions src/sealed.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
#[cfg(feature = "parsing")]
pub(crate) mod lookahead {
#[cfg(not(docsrs))]
pub trait Sealed: Copy {}

#[cfg(docsrs)]
pub trait Sealed {}

#[cfg(docsrs)]
impl<T> Sealed for T {}
}
15 changes: 0 additions & 15 deletions src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,6 @@ macro_rules! define_keywords {
}
}

#[cfg(all(feature = "parsing", docsrs))]
impl crate::lookahead::Peek for $name {
type Token = Self;
}

impl std::default::Default for $name {
fn default() -> Self {
$name {
Expand Down Expand Up @@ -396,11 +391,6 @@ macro_rules! define_punctuation_structs {
}
}

#[cfg(all(feature = "parsing", docsrs))]
impl crate::lookahead::Peek for $name {
type Token = Self;
}

impl std::default::Default for $name {
fn default() -> Self {
$name {
Expand Down Expand Up @@ -510,11 +500,6 @@ macro_rules! define_delimiters {
}
}

#[cfg(all(feature = "parsing", docsrs))]
impl crate::lookahead::Peek for $name {
type Token = Self;
}

impl std::default::Default for $name {
fn default() -> Self {
$name(Span::call_site())
Expand Down

0 comments on commit 666e15e

Please sign in to comment.