10
10
11
11
// Functions dealing with attributes and meta items
12
12
13
- pub use self :: InlineAttr :: * ;
14
13
pub use self :: StabilityLevel :: * ;
15
14
pub use self :: ReprAttr :: * ;
16
15
pub use self :: IntType :: * ;
@@ -285,33 +284,33 @@ pub fn find_crate_name(attrs: &[Attribute]) -> Option<InternedString> {
285
284
286
285
#[ derive( Copy , PartialEq ) ]
287
286
pub enum InlineAttr {
288
- InlineNone ,
289
- InlineHint ,
290
- InlineAlways ,
291
- InlineNever ,
287
+ None ,
288
+ Hint ,
289
+ Always ,
290
+ Never ,
292
291
}
293
292
294
293
/// Determine what `#[inline]` attribute is present in `attrs`, if any.
295
294
pub fn find_inline_attr ( diagnostic : Option < & SpanHandler > , attrs : & [ Attribute ] ) -> InlineAttr {
296
295
// FIXME (#2809)---validate the usage of #[inline] and #[inline]
297
- attrs. iter ( ) . fold ( InlineNone , |ia, attr| {
296
+ attrs. iter ( ) . fold ( InlineAttr :: None , |ia, attr| {
298
297
match attr. node . value . node {
299
298
MetaWord ( ref n) if * n == "inline" => {
300
299
mark_used ( attr) ;
301
- InlineHint
300
+ InlineAttr :: Hint
302
301
}
303
302
MetaList ( ref n, ref items) if * n == "inline" => {
304
303
mark_used ( attr) ;
305
304
if items. len ( ) != 1 {
306
305
diagnostic. map ( |d|{ d. span_err ( attr. span , "expected one argument" ) ; } ) ;
307
- InlineNone
306
+ InlineAttr :: None
308
307
} else if contains_name ( & items[ ..] , "always" ) {
309
- InlineAlways
308
+ InlineAttr :: Always
310
309
} else if contains_name ( & items[ ..] , "never" ) {
311
- InlineNever
310
+ InlineAttr :: Never
312
311
} else {
313
312
diagnostic. map ( |d|{ d. span_err ( ( * items[ 0 ] ) . span , "invalid argument" ) ; } ) ;
314
- InlineNone
313
+ InlineAttr :: None
315
314
}
316
315
}
317
316
_ => ia
@@ -322,8 +321,8 @@ pub fn find_inline_attr(diagnostic: Option<&SpanHandler>, attrs: &[Attribute]) -
322
321
/// True if `#[inline]` or `#[inline(always)]` is present in `attrs`.
323
322
pub fn requests_inline ( attrs : & [ Attribute ] ) -> bool {
324
323
match find_inline_attr ( None , attrs) {
325
- InlineHint | InlineAlways => true ,
326
- InlineNone | InlineNever => false ,
324
+ InlineAttr :: Hint | InlineAttr :: Always => true ,
325
+ InlineAttr :: None | InlineAttr :: Never => false ,
327
326
}
328
327
}
329
328
0 commit comments