@@ -63,28 +63,28 @@ pub fn get_rustdoc(attrs: &[Attribute]) -> GeneratorResult<Option<TokenStream>>
6363 let mut full_docs: Vec < TokenStream > = vec ! [ ] ;
6464 let mut combined_docs_literal = String :: new ( ) ;
6565 for attr in attrs {
66- if let Meta :: NameValue ( nv) = & attr. meta {
67- if nv. path . is_ident ( "doc" ) {
68- match & nv. value {
69- Expr :: Lit ( ExprLit {
70- lit : Lit :: Str ( doc) , ..
71- } ) => {
72- let doc = doc. value ( ) ;
73- let doc_str = doc. trim ( ) ;
66+ if let Meta :: NameValue ( nv) = & attr. meta
67+ && nv. path . is_ident ( "doc" )
68+ {
69+ match & nv. value {
70+ Expr :: Lit ( ExprLit {
71+ lit : Lit :: Str ( doc) , ..
72+ } ) => {
73+ let doc = doc. value ( ) ;
74+ let doc_str = doc. trim ( ) ;
75+ combined_docs_literal += "\n " ;
76+ combined_docs_literal += doc_str;
77+ }
78+ Expr :: Macro ( include_macro) => {
79+ if !combined_docs_literal. is_empty ( ) {
7480 combined_docs_literal += "\n " ;
75- combined_docs_literal += doc_str;
76- }
77- Expr :: Macro ( include_macro) => {
78- if !combined_docs_literal. is_empty ( ) {
79- combined_docs_literal += "\n " ;
80- let lit = LitStr :: new ( & combined_docs_literal, Span :: call_site ( ) ) ;
81- full_docs. push ( quote ! ( #lit ) ) ;
82- combined_docs_literal. clear ( ) ;
83- }
84- full_docs. push ( quote ! ( #include_macro ) ) ;
81+ let lit = LitStr :: new ( & combined_docs_literal, Span :: call_site ( ) ) ;
82+ full_docs. push ( quote ! ( #lit ) ) ;
83+ combined_docs_literal. clear ( ) ;
8584 }
86- _ => ( ) ,
85+ full_docs . push ( quote ! ( #include_macro ) ) ;
8786 }
87+ _ => ( ) ,
8888 }
8989 }
9090 }
@@ -226,10 +226,10 @@ pub fn parse_complexity_expr(expr: Expr) -> GeneratorResult<(HashSet<String>, Ex
226226
227227 impl < ' a > Visit < ' a > for VisitComplexityExpr {
228228 fn visit_expr_path ( & mut self , i : & ' a ExprPath ) {
229- if let Some ( ident) = i. path . get_ident ( ) {
230- if ident != "child_complexity" {
231- self . variables . insert ( ident . to_string ( ) ) ;
232- }
229+ if let Some ( ident) = i. path . get_ident ( )
230+ && ident != "child_complexity"
231+ {
232+ self . variables . insert ( ident . to_string ( ) ) ;
233233 }
234234 }
235235 }
@@ -355,17 +355,17 @@ pub fn gen_directive_calls(
355355}
356356
357357fn extract_directive_call_path ( directive : & Expr ) -> Option < syn:: Path > {
358- if let Expr :: Call ( expr) = directive {
359- if let Expr :: Path ( ref expr) = * expr. func {
360- let mut path = expr. path . clone ( ) ;
361- if path. segments . pop ( ) ?. value ( ) . ident != "apply" {
362- return None ;
363- }
358+ if let Expr :: Call ( expr) = directive
359+ && let Expr :: Path ( ref expr) = * expr. func
360+ {
361+ let mut path = expr. path . clone ( ) ;
362+ if path. segments . pop ( ) ?. value ( ) . ident != "apply" {
363+ return None ;
364+ }
364365
365- path. segments . pop_punct ( ) ?;
366+ path. segments . pop_punct ( ) ?;
366367
367- return Some ( path) ;
368- }
368+ return Some ( path) ;
369369 }
370370
371371 None
0 commit comments