@@ -252,35 +252,18 @@ impl<'a> MetaItemParser<'a> {
252252 }
253253 }
254254
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:
270256 ///
271257 /// - `#[rustfmt::skip]`: `rustfmt::skip` is a path
272258 /// - `#[allow(clippy::complexity)]`: `clippy::complexity` is a path
273259 /// - `#[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
276262 }
277263
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
284267 }
285268
286269 /// Asserts that this MetaItem starts with a word, or single segment path.
@@ -289,23 +272,8 @@ impl<'a> MetaItemParser<'a> {
289272 /// - `#[inline]`: `inline` is a word
290273 /// - `#[rustfmt::skip]`: `rustfmt::skip` is a path,
291274 /// 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.
300275 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 ( ) )
309277 }
310278}
311279
@@ -548,7 +516,7 @@ impl<'a> MetaItemListParser<'a> {
548516 }
549517
550518 /// 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 > > {
552520 self . sub_parsers . iter ( )
553521 }
554522
@@ -560,20 +528,6 @@ impl<'a> MetaItemListParser<'a> {
560528 self . len ( ) == 0
561529 }
562530
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-
577531 /// Returns Some if the list contains only a single element.
578532 ///
579533 /// Inside the Some is the parser to parse this single element.
0 commit comments