aboutsummaryrefslogtreecommitdiffstats
path: root/src/attr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/attr.rs')
-rw-r--r--src/attr.rs41
1 files changed, 5 insertions, 36 deletions
diff --git a/src/attr.rs b/src/attr.rs
index 2a4bced1..fa4f1cb2 100644
--- a/src/attr.rs
+++ b/src/attr.rs
@@ -9,10 +9,6 @@ use proc_macro2::TokenStream;
use crate::parse::{Parse, ParseBuffer, ParseStream, Parser, Result};
#[cfg(feature = "parsing")]
use crate::punctuated::Pair;
-#[cfg(feature = "extra-traits")]
-use crate::tt::TokenStreamHelper;
-#[cfg(feature = "extra-traits")]
-use std::hash::{Hash, Hasher};
ast_struct! {
/// An attribute like `#[repr(transparent)]`.
@@ -139,8 +135,10 @@ ast_struct! {
/// let attr: ItemMod = parse_quote! {
/// #[doc = r" Single line doc comments"]
/// #[doc = r" We write so many!"]
- /// #[doc = r" Multi-line comments...
- /// May span many lines"]
+ /// #[doc = r"
+ /// * Multi-line comments...
+ /// * May span many lines
+ /// "]
/// mod example {
/// #![doc = r" Of course, they can be inner too"]
/// #![doc = r" And fit in a single line "]
@@ -148,7 +146,7 @@ ast_struct! {
/// };
/// assert_eq!(doc, attr);
/// ```
- pub struct Attribute #manual_extra_traits {
+ pub struct Attribute {
pub pound_token: Token![#],
pub style: AttrStyle,
pub bracket_token: token::Bracket,
@@ -157,34 +155,6 @@ ast_struct! {
}
}
-#[cfg(feature = "extra-traits")]
-impl Eq for Attribute {}
-
-#[cfg(feature = "extra-traits")]
-impl PartialEq for Attribute {
- fn eq(&self, other: &Self) -> bool {
- self.style == other.style
- && self.pound_token == other.pound_token
- && self.bracket_token == other.bracket_token
- && self.path == other.path
- && TokenStreamHelper(&self.tokens) == TokenStreamHelper(&other.tokens)
- }
-}
-
-#[cfg(feature = "extra-traits")]
-impl Hash for Attribute {
- fn hash<H>(&self, state: &mut H)
- where
- H: Hasher,
- {
- self.style.hash(state);
- self.pound_token.hash(state);
- self.bracket_token.hash(state);
- self.path.hash(state);
- TokenStreamHelper(&self.tokens).hash(state);
- }
-}
-
impl Attribute {
/// Parses the content of the attribute, consisting of the path and tokens,
/// as a [`Meta`] if possible.
@@ -353,7 +323,6 @@ ast_enum! {
/// - `#![feature(proc_macro)]`
/// - `//! # Example`
/// - `/*! Please file an issue */`
- #[cfg_attr(feature = "clone-impls", derive(Copy))]
pub enum AttrStyle {
Outer,
Inner(Token![!]),