@@ -252,35 +252,18 @@ impl<'a> MetaItemParser<'a> {
252
252
}
253
253
}
254
254
255
- /// Gets just the path, without the args.
256
- pub fn path_without_args ( & self ) -> PathParser < ' a > {
257
- self . path . clone ( )
258
- }
259
-
260
- /// Gets just the args parser, without caring about the path.
261
- pub fn args ( & self ) -> & ArgParser < ' a > {
262
- & self . args
263
- }
264
-
265
- pub fn deconstruct ( & self ) -> ( PathParser < ' a > , & ArgParser < ' a > ) {
266
- ( self . path_without_args ( ) , self . args ( ) )
267
- }
268
-
269
- /// Asserts that this MetaItem starts with a path. Some examples:
255
+ /// Gets just the path, without the args. Some examples:
270
256
///
271
257
/// - `#[rustfmt::skip]`: `rustfmt::skip` is a path
272
258
/// - `#[allow(clippy::complexity)]`: `clippy::complexity` is a path
273
259
/// - `#[inline]`: `inline` is a single segment path
274
- pub fn path ( & self ) -> ( PathParser < ' a > , & ArgParser < ' a > ) {
275
- self . deconstruct ( )
260
+ pub fn path ( & self ) -> & PathParser < ' a > {
261
+ & self . path
276
262
}
277
263
278
- /// Asserts that this MetaItem starts with a word, or single segment path.
279
- /// Doesn't return the args parser.
280
- ///
281
- /// For examples. see [`Self::word`]
282
- pub fn word_without_args ( & self ) -> Option < Ident > {
283
- Some ( self . word ( ) ?. 0 )
264
+ /// Gets just the args parser, without caring about the path.
265
+ pub fn args ( & self ) -> & ArgParser < ' a > {
266
+ & self . args
284
267
}
285
268
286
269
/// Asserts that this MetaItem starts with a word, or single segment path.
@@ -289,23 +272,8 @@ impl<'a> MetaItemParser<'a> {
289
272
/// - `#[inline]`: `inline` is a word
290
273
/// - `#[rustfmt::skip]`: `rustfmt::skip` is a path,
291
274
/// and not a word and should instead be parsed using [`path`](Self::path)
292
- pub fn word ( & self ) -> Option < ( Ident , & ArgParser < ' a > ) > {
293
- let ( path, args) = self . deconstruct ( ) ;
294
- Some ( ( path. word ( ) ?, args) )
295
- }
296
-
297
- /// Asserts that this MetaItem starts with some specific word.
298
- ///
299
- /// See [`word`](Self::word) for examples of what a word is.
300
275
pub fn word_is ( & self , sym : Symbol ) -> Option < & ArgParser < ' a > > {
301
- self . path_without_args ( ) . word_is ( sym) . then ( || self . args ( ) )
302
- }
303
-
304
- /// Asserts that this MetaItem starts with some specific path.
305
- ///
306
- /// See [`word`](Self::path) for examples of what a word is.
307
- pub fn path_is ( & self , segments : & [ Symbol ] ) -> Option < & ArgParser < ' a > > {
308
- self . path_without_args ( ) . segments_is ( segments) . then ( || self . args ( ) )
276
+ self . path ( ) . word_is ( sym) . then ( || self . args ( ) )
309
277
}
310
278
}
311
279
@@ -548,7 +516,7 @@ impl<'a> MetaItemListParser<'a> {
548
516
}
549
517
550
518
/// Lets you pick and choose as what you want to parse each element in the list
551
- pub fn mixed < ' s > ( & ' s self ) -> impl Iterator < Item = & ' s MetaItemOrLitParser < ' a > > + ' s {
519
+ pub fn mixed ( & self ) -> impl Iterator < Item = & MetaItemOrLitParser < ' a > > {
552
520
self . sub_parsers . iter ( )
553
521
}
554
522
@@ -560,20 +528,6 @@ impl<'a> MetaItemListParser<'a> {
560
528
self . len ( ) == 0
561
529
}
562
530
563
- /// Asserts that every item in the list is another list starting with a word.
564
- ///
565
- /// See [`MetaItemParser::word`] for examples of words.
566
- pub fn all_word_list < ' s > ( & ' s self ) -> Option < Vec < ( Ident , & ' s ArgParser < ' a > ) > > {
567
- self . mixed ( ) . map ( |i| i. meta_item ( ) ?. word ( ) ) . collect ( )
568
- }
569
-
570
- /// Asserts that every item in the list is another list starting with a full path.
571
- ///
572
- /// See [`MetaItemParser::path`] for examples of paths.
573
- pub fn all_path_list < ' s > ( & ' s self ) -> Option < Vec < ( PathParser < ' a > , & ' s ArgParser < ' a > ) > > {
574
- self . mixed ( ) . map ( |i| Some ( i. meta_item ( ) ?. path ( ) ) ) . collect ( )
575
- }
576
-
577
531
/// Returns Some if the list contains only a single element.
578
532
///
579
533
/// Inside the Some is the parser to parse this single element.
0 commit comments