Skip to content

Commit 314c12a

Browse files
committed
Remove MetaItemParser::{path,deconstruct}.
They're equivalent, and `path` is unused, and `deconstruct` has only one call site outside of `path`.
1 parent cf93f55 commit 314c12a

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ impl<'sess> AttributeParser<'sess> {
260260
// }
261261
ast::AttrKind::Normal(n) => {
262262
let parser = MetaItemParser::from_attr(n, self.dcx());
263-
let (path, args) = parser.deconstruct();
263+
let path = parser.path_without_args();
264+
let args = parser.args();
264265
let parts = path.segments().map(|i| i.name).collect::<Vec<_>>();
265266

266267
if let Some(accepts) = ATTRIBUTE_MAPPING.0.get(parts.as_slice()) {

compiler/rustc_attr_parsing/src/parser.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,11 @@ impl<'a> MetaItemParser<'a> {
253253
}
254254
}
255255

256-
/// Gets just the path, without the args.
256+
/// Gets just the path, without the args. Some examples:
257+
///
258+
/// - `#[rustfmt::skip]`: `rustfmt::skip` is a path
259+
/// - `#[allow(clippy::complexity)]`: `clippy::complexity` is a path
260+
/// - `#[inline]`: `inline` is a single segment path
257261
pub fn path_without_args(&self) -> PathParser<'a> {
258262
self.path.clone()
259263
}
@@ -263,19 +267,6 @@ impl<'a> MetaItemParser<'a> {
263267
&self.args
264268
}
265269

266-
pub fn deconstruct(&self) -> (PathParser<'a>, &ArgParser<'a>) {
267-
(self.path_without_args(), self.args())
268-
}
269-
270-
/// Asserts that this MetaItem starts with a path. Some examples:
271-
///
272-
/// - `#[rustfmt::skip]`: `rustfmt::skip` is a path
273-
/// - `#[allow(clippy::complexity)]`: `clippy::complexity` is a path
274-
/// - `#[inline]`: `inline` is a single segment path
275-
pub fn path(&self) -> (PathParser<'a>, &ArgParser<'a>) {
276-
self.deconstruct()
277-
}
278-
279270
/// Asserts that this MetaItem starts with a word, or single segment path.
280271
///
281272
/// Some examples:

0 commit comments

Comments
 (0)