Skip to content

Update Clippy for changes in rustc #3604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clippy_lints/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,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) {
check_attrs(cx, item.span, item.name, &item.attrs)
check_attrs(cx, item.span, item.ident.name, &item.attrs)
}
match item.node {
ItemKind::ExternCrate(..) | ItemKind::Use(..) => {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/len_zero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item, trait_items
visited_trait.span,
&format!(
"trait `{}` has a `len` method but no (possibly inherited) `is_empty` method",
visited_trait.name
visited_trait.ident
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/missing_doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
hir::ItemKind::Enum(..) => "an enum",
hir::ItemKind::Fn(..) => {
// ignore main()
if it.name == "main" {
if it.ident.name == "main" {
let def_id = cx.tcx.hir().local_def_id(it.id);
let def_key = cx.tcx.hir().def_key(def_id);
if def_key.parent == Some(hir::def_id::CRATE_DEF_INDEX) {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ fn print_expr(cx: &LateContext<'_, '_>, expr: &hir::Expr, indent: usize) {

fn print_item(cx: &LateContext<'_, '_>, item: &hir::Item) {
let did = cx.tcx.hir().local_def_id(item.id);
println!("item `{}`", item.name);
println!("item `{}`", item.ident);
match item.vis.node {
hir::VisibilityKind::Public => println!("public"),
hir::VisibilityKind::Crate(_) => println!("visible crate wide"),
Expand Down
12 changes: 6 additions & 6 deletions clippy_lints/src/utils/internal_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ use rustc::lint::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintAr
use rustc::{declare_tool_lint, lint_array};
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_errors::Applicability;
use syntax::ast::{Crate as AstCrate, Ident, ItemKind, Name};
use syntax::ast::{Crate as AstCrate, Ident, ItemKind};
use syntax::source_map::Span;
use syntax::symbol::LocalInternedString;
use syntax::symbol::{LocalInternedString, Symbol};

/// **What it does:** Checks for various things we like to keep tidy in clippy.
///
Expand Down Expand Up @@ -140,8 +140,8 @@ impl EarlyLintPass for Clippy {

#[derive(Clone, Debug, Default)]
pub struct LintWithoutLintPass {
declared_lints: FxHashMap<Name, Span>,
registered_lints: FxHashSet<Name>,
declared_lints: FxHashMap<Symbol, Span>,
registered_lints: FxHashSet<Symbol>,
}

impl LintPass for LintWithoutLintPass {
Expand All @@ -154,7 +154,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LintWithoutLintPass {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
if let hir::ItemKind::Static(ref ty, MutImmutable, _) = item.node {
if is_lint_ref_type(cx, ty) {
self.declared_lints.insert(item.name, item.span);
self.declared_lints.insert(item.ident.name, item.span);
}
} else if let hir::ItemKind::Impl(.., Some(ref trait_ref), _, ref impl_item_refs) = item.node {
if_chain! {
Expand Down Expand Up @@ -221,7 +221,7 @@ fn is_lint_ref_type<'tcx>(cx: &LateContext<'_, 'tcx>, ty: &Ty) -> bool {
}

struct LintCollector<'a, 'tcx: 'a> {
output: &'a mut FxHashSet<Name>,
output: &'a mut FxHashSet<Symbol>,
cx: &'a LateContext<'a, 'tcx>,
}

Expand Down
7 changes: 3 additions & 4 deletions clippy_lints/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,9 @@ pub fn method_chain_args<'a>(expr: &'a Expr, methods: &[&str]) -> Option<Vec<&'a
pub fn get_item_name(cx: &LateContext<'_, '_>, expr: &Expr) -> Option<Name> {
let parent_id = cx.tcx.hir().get_parent(expr.id);
match cx.tcx.hir().find(parent_id) {
Some(Node::Item(&Item { ref name, .. })) => Some(*name),
Some(Node::TraitItem(&TraitItem { ident, .. })) | Some(Node::ImplItem(&ImplItem { ident, .. })) => {
Some(ident.name)
},
Some(Node::Item(&Item { ident, .. }))
| Some(Node::TraitItem(&TraitItem { ident, .. }))
| Some(Node::ImplItem(&ImplItem { ident, .. })) => Some(ident.name),
_ => None,
}
}
Expand Down