name -> ident_str

This commit is contained in:
Mateusz Mikuła 2019-03-18 12:04:06 +01:00 committed by Mateusz Mikuła
parent e63a685412
commit b25564fc8a
2 changed files with 7 additions and 3 deletions

View File

@ -208,7 +208,8 @@ impl LintPass for AttrPass {
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
fn check_attribute(&mut self, cx: &LateContext<'a, 'tcx>, attr: &'tcx Attribute) {
if let Some(items) = &attr.meta_item_list() {
match &*attr.name().as_str() {
if let Some(ident) = attr.ident_str() {
match ident {
"allow" | "warn" | "deny" | "forbid" => {
check_clippy_lint_names(cx, items);
},
@ -229,6 +230,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
}
}
}
}
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
if is_relevant_item(cx.tcx, item) {
@ -240,7 +242,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
for attr in &item.attrs {
if let Some(lint_list) = &attr.meta_item_list() {
match &*attr.name().as_str() {
if let Some(ident) = attr.ident_str() {
match ident {
"allow" | "warn" | "deny" | "forbid" => {
// whitelist `unused_imports` and `deprecated` for `use` items
// and `unused_imports` for `extern crate` items with `macro_use`
@ -288,6 +291,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
}
}
}
}
},
_ => {},
}

View File

@ -58,7 +58,7 @@ impl MissingDoc {
if let Some(meta) = meta;
if let MetaItemKind::List(list) = meta.node;
if let Some(meta) = list.get(0);
if let Some(name) = meta.name();
if let Some(name) = meta.ident_str();
then {
name == "include"
} else {