@@ -22,26 +22,25 @@ impl<'a> Parser<'a> {
2222 pub fn parse_outer_attributes ( & mut self ) -> PResult < ' a , Vec < ast:: Attribute > > {
2323 let mut attrs: Vec < ast:: Attribute > = Vec :: new ( ) ;
2424 loop {
25- debug ! ( "parse_outer_attributes: self.token={:?}" ,
26- self . token) ;
25+ debug ! ( "parse_outer_attributes: self.token={:?}" , self . token) ;
2726 match self . token {
28- token:: Pound => {
29- attrs. push ( try!( self . parse_attribute ( false ) ) ) ;
30- }
31- token:: DocComment ( s) => {
32- let attr = :: attr:: mk_sugared_doc_attr (
27+ token:: Pound => {
28+ attrs. push ( try!( self . parse_attribute ( false ) ) ) ;
29+ }
30+ token:: DocComment ( s) => {
31+ let attr = :: attr:: mk_sugared_doc_attr (
3332 attr:: mk_attr_id ( ) ,
3433 self . id_to_interned_str ( ast:: Ident :: with_empty_ctxt ( s) ) ,
3534 self . span . lo ,
3635 self . span . hi
3736 ) ;
38- if attr. node . style != ast:: AttrStyle :: Outer {
39- return Err ( self . fatal ( "expected outer comment" ) ) ;
37+ if attr. node . style != ast:: AttrStyle :: Outer {
38+ return Err ( self . fatal ( "expected outer comment" ) ) ;
39+ }
40+ attrs. push ( attr) ;
41+ self . bump ( ) ;
4042 }
41- attrs. push ( attr) ;
42- self . bump ( ) ;
43- }
44- _ => break
43+ _ => break ,
4544 }
4645 }
4746 return Ok ( attrs) ;
@@ -53,24 +52,27 @@ impl<'a> Parser<'a> {
5352 /// attribute
5453 pub fn parse_attribute ( & mut self , permit_inner : bool ) -> PResult < ' a , ast:: Attribute > {
5554 debug ! ( "parse_attributes: permit_inner={:?} self.token={:?}" ,
56- permit_inner, self . token) ;
55+ permit_inner,
56+ self . token) ;
5757 let ( span, value, mut style) = match self . token {
5858 token:: Pound => {
5959 let lo = self . span . lo ;
6060 self . bump ( ) ;
6161
62- if permit_inner { self . expected_tokens . push ( TokenType :: Token ( token:: Not ) ) ; }
62+ if permit_inner {
63+ self . expected_tokens . push ( TokenType :: Token ( token:: Not ) ) ;
64+ }
6365 let style = if self . token == token:: Not {
6466 self . bump ( ) ;
6567 if !permit_inner {
6668 let span = self . span ;
67- self . diagnostic ( ) . struct_span_err ( span ,
68- "an inner attribute is not permitted in \
69- this context")
70- . fileline_help ( span,
71- "place inner attribute at the top of \
72- the module or block")
73- . emit ( )
69+ self . diagnostic ( )
70+ . struct_span_err ( span ,
71+ "an inner attribute is not permitted in this context")
72+ . fileline_help ( span,
73+ "place inner attribute at the top of the module or \
74+ block")
75+ . emit ( )
7476 }
7577 ast:: AttrStyle :: Inner
7678 } else {
@@ -92,8 +94,9 @@ impl<'a> Parser<'a> {
9294
9395 if permit_inner && self . token == token:: Semi {
9496 self . bump ( ) ;
95- self . span_warn ( span, "this inner attribute syntax is deprecated. \
96- The new syntax is `#![foo]`, with a bang and no semicolon") ;
97+ self . span_warn ( span,
98+ "this inner attribute syntax is deprecated. The new syntax is \
99+ `#![foo]`, with a bang and no semicolon") ;
97100 style = ast:: AttrStyle :: Inner ;
98101 }
99102
@@ -103,8 +106,8 @@ impl<'a> Parser<'a> {
103106 id : attr:: mk_attr_id ( ) ,
104107 style : style,
105108 value : value,
106- is_sugared_doc : false
107- }
109+ is_sugared_doc : false ,
110+ } ,
108111 } )
109112 }
110113
@@ -139,7 +142,7 @@ impl<'a> Parser<'a> {
139142 break ;
140143 }
141144 }
142- _ => break
145+ _ => break ,
143146 }
144147 }
145148 Ok ( attrs)
@@ -150,10 +153,8 @@ impl<'a> Parser<'a> {
150153 /// | IDENT meta_seq
151154 pub fn parse_meta_item ( & mut self ) -> PResult < ' a , P < ast:: MetaItem > > {
152155 let nt_meta = match self . token {
153- token:: Interpolated ( token:: NtMeta ( ref e) ) => {
154- Some ( e. clone ( ) )
155- }
156- _ => None
156+ token:: Interpolated ( token:: NtMeta ( ref e) ) => Some ( e. clone ( ) ) ,
157+ _ => None ,
157158 } ;
158159
159160 match nt_meta {
@@ -176,9 +177,8 @@ impl<'a> Parser<'a> {
176177 match lit. node {
177178 ast:: LitStr ( ..) => { }
178179 _ => {
179- self . span_err (
180- lit. span ,
181- "non-string literals are not allowed in meta-items" ) ;
180+ self . span_err ( lit. span ,
181+ "non-string literals are not allowed in meta-items" ) ;
182182 }
183183 }
184184 let hi = self . span . hi ;
0 commit comments