Rename MetaItemParser::path_without_args as MetaItemParser::path.
And avoid the clone.
This commit is contained in:
@@ -53,7 +53,7 @@ fn parse_unstable<'a>(
|
||||
|
||||
for param in list.mixed() {
|
||||
let param_span = param.span();
|
||||
if let Some(ident) = param.meta_item().and_then(|i| i.path_without_args().word()) {
|
||||
if let Some(ident) = param.meta_item().and_then(|i| i.path().word()) {
|
||||
res.push(ident.name);
|
||||
} else {
|
||||
cx.emit_err(session_diagnostics::ExpectsFeatures {
|
||||
|
||||
@@ -79,7 +79,7 @@ impl SingleAttributeParser for DeprecationParser {
|
||||
return None;
|
||||
};
|
||||
|
||||
let ident_name = param.path_without_args().word_sym();
|
||||
let ident_name = param.path().word_sym();
|
||||
|
||||
match ident_name {
|
||||
Some(name @ sym::since) => {
|
||||
@@ -102,7 +102,7 @@ impl SingleAttributeParser for DeprecationParser {
|
||||
_ => {
|
||||
cx.emit_err(session_diagnostics::UnknownMetaItem {
|
||||
span: param_span,
|
||||
item: param.path_without_args().to_string(),
|
||||
item: param.path().to_string(),
|
||||
expected: if features.deprecated_suggestion() {
|
||||
&["since", "note", "suggestion"]
|
||||
} else {
|
||||
|
||||
@@ -96,7 +96,7 @@ fn parse_repr(cx: &AcceptContext<'_>, param: &MetaItemParser<'_>) -> Option<Repr
|
||||
|
||||
// FIXME(jdonszelmann): invert the parsing here to match on the word first and then the
|
||||
// structure.
|
||||
let (name, ident_span) = if let Some(ident) = param.path_without_args().word() {
|
||||
let (name, ident_span) = if let Some(ident) = param.path().word() {
|
||||
(Some(ident.name), ident.span)
|
||||
} else {
|
||||
(None, rustc_span::DUMMY_SP)
|
||||
|
||||
@@ -204,7 +204,7 @@ fn insert_value_into_option_or_error(
|
||||
if item.is_some() {
|
||||
cx.emit_err(session_diagnostics::MultipleItem {
|
||||
span: param.span(),
|
||||
item: param.path_without_args().to_string(),
|
||||
item: param.path().to_string(),
|
||||
});
|
||||
None
|
||||
} else if let Some(v) = param.args().name_value()
|
||||
@@ -242,13 +242,13 @@ pub(crate) fn parse_stability(
|
||||
return None;
|
||||
};
|
||||
|
||||
match param.path_without_args().word_sym() {
|
||||
match param.path().word_sym() {
|
||||
Some(sym::feature) => insert_value_into_option_or_error(cx, ¶m, &mut feature)?,
|
||||
Some(sym::since) => insert_value_into_option_or_error(cx, ¶m, &mut since)?,
|
||||
_ => {
|
||||
cx.emit_err(session_diagnostics::UnknownMetaItem {
|
||||
span: param_span,
|
||||
item: param.path_without_args().to_string(),
|
||||
item: param.path().to_string(),
|
||||
expected: &["feature", "since"],
|
||||
});
|
||||
return None;
|
||||
@@ -310,7 +310,7 @@ pub(crate) fn parse_unstability(
|
||||
return None;
|
||||
};
|
||||
|
||||
match param.path_without_args().word_sym() {
|
||||
match param.path().word_sym() {
|
||||
Some(sym::feature) => insert_value_into_option_or_error(cx, ¶m, &mut feature)?,
|
||||
Some(sym::reason) => insert_value_into_option_or_error(cx, ¶m, &mut reason)?,
|
||||
Some(sym::issue) => {
|
||||
@@ -349,7 +349,7 @@ pub(crate) fn parse_unstability(
|
||||
_ => {
|
||||
cx.emit_err(session_diagnostics::UnknownMetaItem {
|
||||
span: param.span(),
|
||||
item: param.path_without_args().to_string(),
|
||||
item: param.path().to_string(),
|
||||
expected: &["feature", "reason", "issue", "soft", "implied_by"],
|
||||
});
|
||||
return None;
|
||||
|
||||
Reference in New Issue
Block a user