Rename MetaItemParser::path_without_args as MetaItemParser::path.

And avoid the clone.
This commit is contained in:
Nicholas Nethercote
2025-05-20 12:41:56 +10:00
parent 2cd2d24967
commit e5c78de85c
6 changed files with 13 additions and 13 deletions

View File

@@ -258,8 +258,8 @@ impl<'a> MetaItemParser<'a> {
/// - `#[rustfmt::skip]`: `rustfmt::skip` is a path
/// - `#[allow(clippy::complexity)]`: `clippy::complexity` is a path
/// - `#[inline]`: `inline` is a single segment path
pub fn path_without_args(&self) -> PathParser<'a> {
self.path.clone()
pub fn path(&self) -> &PathParser<'a> {
&self.path
}
/// Gets just the args parser, without caring about the path.
@@ -274,7 +274,7 @@ impl<'a> MetaItemParser<'a> {
/// - `#[rustfmt::skip]`: `rustfmt::skip` is a path,
/// and not a word and should instead be parsed using [`path`](Self::path)
pub fn word_is(&self, sym: Symbol) -> Option<&ArgParser<'a>> {
self.path_without_args().word_is(sym).then(|| self.args())
self.path().word_is(sym).then(|| self.args())
}
}