diff options
author | David Tolnay <dtolnay@gmail.com> | 2018-05-20 20:02:28 -0700 |
---|---|---|
committer | David Tolnay <dtolnay@gmail.com> | 2018-05-20 20:02:28 -0700 |
commit | 65fb5664a8f21631f61a36c18c47a679ff29e1e0 (patch) | |
tree | 712fcf9c4c80ae994f635fe42fb14df2d2b9d2fc /src | |
parent | 34071ba2468722fb6d901ef99212ba8f3e8018fc (diff) | |
download | syn-65fb5664a8f21631f61a36c18c47a679ff29e1e0.tar.gz |
Format with rustfmt 0.7.0
Diffstat (limited to 'src')
-rw-r--r-- | src/attr.rs | 6 | ||||
-rw-r--r-- | src/buffer.rs | 2 | ||||
-rw-r--r-- | src/derive.rs | 2 | ||||
-rw-r--r-- | src/file.rs | 2 | ||||
-rw-r--r-- | src/generics.rs | 2 | ||||
-rw-r--r-- | src/item.rs | 9 | ||||
-rw-r--r-- | src/lib.rs | 11 | ||||
-rw-r--r-- | src/lifetime.rs | 4 | ||||
-rw-r--r-- | src/lit.rs | 2 | ||||
-rw-r--r-- | src/mac.rs | 5 | ||||
-rw-r--r-- | src/op.rs | 2 | ||||
-rw-r--r-- | src/path.rs | 2 | ||||
-rw-r--r-- | src/punctuated.rs | 2 | ||||
-rw-r--r-- | src/synom.rs | 24 | ||||
-rw-r--r-- | src/token.rs | 16 | ||||
-rw-r--r-- | src/ty.rs | 2 |
16 files changed, 44 insertions, 49 deletions
diff --git a/src/attr.rs b/src/attr.rs index 6f50e0a3..2d0f244a 100644 --- a/src/attr.rs +++ b/src/attr.rs @@ -74,8 +74,10 @@ 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 + self.style == other.style + && self.pound_token == other.pound_token + && self.bracket_token == other.bracket_token + && self.path == other.path && TokenStreamHelper(&self.tts) == TokenStreamHelper(&other.tts) && self.is_sugared_doc == other.is_sugared_doc } diff --git a/src/buffer.rs b/src/buffer.rs index d695c770..3ca7f7f1 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -129,7 +129,7 @@ #[cfg(feature = "proc-macro")] use proc_macro as pm; -use proc_macro2::{Delimiter, Literal, Span, Ident, TokenStream}; +use proc_macro2::{Delimiter, Ident, Literal, Span, TokenStream}; use proc_macro2::{Group, Punct, TokenTree}; use std::marker::PhantomData; diff --git a/src/derive.rs b/src/derive.rs index ba60f8df..e1cb1107 100644 --- a/src/derive.rs +++ b/src/derive.rs @@ -163,8 +163,8 @@ pub mod parsing { mod printing { use super::*; use attr::FilterAttrs; - use quote::ToTokens; use proc_macro2::TokenStream; + use quote::ToTokens; impl ToTokens for DeriveInput { fn to_tokens(&self, tokens: &mut TokenStream) { diff --git a/src/file.rs b/src/file.rs index 99a311dd..9b5b11f2 100644 --- a/src/file.rs +++ b/src/file.rs @@ -111,8 +111,8 @@ pub mod parsing { mod printing { use super::*; use attr::FilterAttrs; - use quote::{ToTokens, TokenStreamExt}; use proc_macro2::TokenStream; + use quote::{ToTokens, TokenStreamExt}; impl ToTokens for File { fn to_tokens(&self, tokens: &mut TokenStream) { diff --git a/src/generics.rs b/src/generics.rs index 4c2858de..970e1ff9 100644 --- a/src/generics.rs +++ b/src/generics.rs @@ -753,8 +753,8 @@ pub mod parsing { mod printing { use super::*; use attr::FilterAttrs; - use quote::{ToTokens, TokenStreamExt}; use proc_macro2::TokenStream; + use quote::{ToTokens, TokenStreamExt}; impl ToTokens for Generics { fn to_tokens(&self, tokens: &mut TokenStream) { diff --git a/src/item.rs b/src/item.rs index 226e102f..3f1ad79c 100644 --- a/src/item.rs +++ b/src/item.rs @@ -248,8 +248,11 @@ impl Eq for ItemMacro2 {} #[cfg(feature = "extra-traits")] impl PartialEq for ItemMacro2 { fn eq(&self, other: &Self) -> bool { - self.attrs == other.attrs && self.vis == other.vis && self.macro_token == other.macro_token - && self.ident == other.ident && self.paren_token == other.paren_token + self.attrs == other.attrs + && self.vis == other.vis + && self.macro_token == other.macro_token + && self.ident == other.ident + && self.paren_token == other.paren_token && TokenStreamHelper(&self.args) == TokenStreamHelper(&other.args) && self.brace_token == other.brace_token && TokenStreamHelper(&self.body) == TokenStreamHelper(&other.body) @@ -1536,8 +1539,8 @@ pub mod parsing { mod printing { use super::*; use attr::FilterAttrs; - use quote::{ToTokens, TokenStreamExt}; use proc_macro2::TokenStream; + use quote::{ToTokens, TokenStreamExt}; impl ToTokens for ItemExternCrate { fn to_tokens(&self, tokens: &mut TokenStream) { @@ -260,7 +260,6 @@ // Syn types in rustdoc of other crates get linked to here. #![doc(html_root_url = "https://docs.rs/syn/0.13.11")] #![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))] - // Ignored clippy lints. #![cfg_attr( feature = "cargo-clippy", @@ -273,14 +272,8 @@ #![cfg_attr( feature = "cargo-clippy", allow( - cast_possible_truncation, - cast_possible_wrap, - items_after_statements, - similar_names, - single_match_else, - stutter, - unseparated_literal_suffix, - use_self, + cast_possible_truncation, cast_possible_wrap, items_after_statements, similar_names, + single_match_else, stutter, unseparated_literal_suffix, use_self ) )] diff --git a/src/lifetime.rs b/src/lifetime.rs index bf8147b4..74f4f68e 100644 --- a/src/lifetime.rs +++ b/src/lifetime.rs @@ -10,7 +10,7 @@ use std::cmp::Ordering; use std::fmt::{self, Display}; use std::hash::{Hash, Hasher}; -use proc_macro2::{Span, Ident}; +use proc_macro2::{Ident, Span}; use unicode_xid::UnicodeXID; use token::Apostrophe; @@ -139,8 +139,8 @@ pub mod parsing { #[cfg(feature = "printing")] mod printing { use super::*; - use quote::ToTokens; use proc_macro2::TokenStream; + use quote::ToTokens; impl ToTokens for Lifetime { fn to_tokens(&self, tokens: &mut TokenStream) { @@ -506,8 +506,8 @@ pub mod parsing { #[cfg(feature = "printing")] mod printing { use super::*; - use quote::{ToTokens, TokenStreamExt}; use proc_macro2::TokenStream; + use quote::{ToTokens, TokenStreamExt}; impl ToTokens for LitStr { fn to_tokens(&self, tokens: &mut TokenStream) { @@ -46,7 +46,8 @@ impl Eq for Macro {} #[cfg(feature = "extra-traits")] impl PartialEq for Macro { fn eq(&self, other: &Self) -> bool { - self.path == other.path && self.bang_token == other.bang_token + self.path == other.path + && self.bang_token == other.bang_token && self.delimiter == other.delimiter && TokenStreamHelper(&self.tts) == TokenStreamHelper(&other.tts) } @@ -93,8 +94,8 @@ pub mod parsing { #[cfg(feature = "printing")] mod printing { use super::*; - use quote::ToTokens; use proc_macro2::TokenStream; + use quote::ToTokens; impl ToTokens for Macro { fn to_tokens(&self, tokens: &mut TokenStream) { @@ -174,8 +174,8 @@ pub mod parsing { #[cfg(feature = "printing")] mod printing { use super::*; - use quote::ToTokens; use proc_macro2::TokenStream; + use quote::ToTokens; impl ToTokens for BinOp { fn to_tokens(&self, tokens: &mut TokenStream) { diff --git a/src/path.rs b/src/path.rs index cded4359..19c1f057 100644 --- a/src/path.rs +++ b/src/path.rs @@ -418,8 +418,8 @@ pub mod parsing { #[cfg(feature = "printing")] mod printing { use super::*; - use quote::ToTokens; use proc_macro2::TokenStream; + use quote::ToTokens; impl ToTokens for Path { fn to_tokens(&self, tokens: &mut TokenStream) { diff --git a/src/punctuated.rs b/src/punctuated.rs index 8f4144f3..a06abb5e 100644 --- a/src/punctuated.rs +++ b/src/punctuated.rs @@ -762,8 +762,8 @@ where #[cfg(feature = "printing")] mod printing { use super::*; - use quote::{ToTokens, TokenStreamExt}; use proc_macro2::TokenStream; + use quote::{ToTokens, TokenStreamExt}; impl<T, P> ToTokens for Punctuated<T, P> where diff --git a/src/synom.rs b/src/synom.rs index 28444f3d..a018ff3d 100644 --- a/src/synom.rs +++ b/src/synom.rs @@ -154,8 +154,8 @@ use proc_macro; use proc_macro2; -pub use error::{PResult, ParseError}; use error::parse_error; +pub use error::{PResult, ParseError}; use buffer::{Cursor, TokenBuffer}; @@ -215,12 +215,12 @@ impl Synom for proc_macro2::TokenStream { } impl Synom for proc_macro2::Ident { - fn parse(input: Cursor) -> PResult<Self> { - let (term, rest) = match input.ident() { - Some(term) => term, - _ => return parse_error(), - }; - match &term.to_string()[..] { + fn parse(input: Cursor) -> PResult<Self> { + let (term, rest) = match input.ident() { + Some(term) => term, + _ => return parse_error(), + }; + match &term.to_string()[..] { "_" // From https://doc.rust-lang.org/grammar.html#keywords | "abstract" | "alignof" | "as" | "become" | "box" | "break" | "const" @@ -233,12 +233,12 @@ impl Synom for proc_macro2::Ident { _ => {} } - Ok((term, rest)) - } + Ok((term, rest)) + } - fn description() -> Option<&'static str> { - Some("identifier") - } + fn description() -> Option<&'static str> { + Some("identifier") + } } /// Parser that can parse Rust tokens into a particular syntax tree node. diff --git a/src/token.rs b/src/token.rs index 97f33f18..37a0b35a 100644 --- a/src/token.rs +++ b/src/token.rs @@ -97,7 +97,7 @@ //! # fn main() {} //! ``` -use proc_macro2::{Span, Ident}; +use proc_macro2::{Ident, Span}; macro_rules! tokens { ( @@ -119,7 +119,7 @@ macro_rules! tokens { } macro_rules! token_punct_def { - (#[$doc:meta] pub struct $name:ident / $len:tt) => { + (#[$doc:meta]pub struct $name:ident / $len:tt) => { #[cfg_attr(feature = "clone-impls", derive(Copy, Clone))] #[$doc] /// @@ -400,7 +400,7 @@ impl ::Synom for Apostrophe { ::parse_error() } } - None => ::parse_error() + None => ::parse_error(), } } @@ -788,7 +788,7 @@ mod parsing { *slot = op.span(); tokens = rest; } else { - return parse_error() + return parse_error(); } } _ => return parse_error(), @@ -797,11 +797,7 @@ mod parsing { Ok((new(T::from_spans(&spans)), tokens)) } - pub fn keyword<'a, T>( - keyword: &str, - tokens: Cursor<'a>, - new: fn(Span) -> T, - ) -> PResult<'a, T> { + pub fn keyword<'a, T>(keyword: &str, tokens: Cursor<'a>, new: fn(Span) -> T) -> PResult<'a, T> { if let Some((term, rest)) = tokens.ident() { if term == keyword { return Ok((new(term.span()), rest)); @@ -844,7 +840,7 @@ mod parsing { #[cfg(feature = "printing")] mod printing { - use proc_macro2::{Delimiter, Group, Punct, Spacing, Span, Ident, TokenStream}; + use proc_macro2::{Delimiter, Group, Ident, Punct, Spacing, Span, TokenStream}; use quote::TokenStreamExt; pub fn punct(s: &str, spans: &[Span], tokens: &mut TokenStream) { @@ -646,8 +646,8 @@ pub mod parsing { #[cfg(feature = "printing")] mod printing { use super::*; - use quote::ToTokens; use proc_macro2::TokenStream; + use quote::ToTokens; impl ToTokens for TypeSlice { fn to_tokens(&self, tokens: &mut TokenStream) { |