mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-14 17:07:17 +00:00
Merge branch 'master' of https://github.com/rust-lang/rust-clippy into random-state-lint
This commit is contained in:
commit
1130bbc26f
6 changed files with 6 additions and 6 deletions
|
@ -237,7 +237,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
|
||||||
|
|
||||||
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
|
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
|
||||||
if is_relevant_item(cx.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 {
|
match item.node {
|
||||||
ItemKind::ExternCrate(..) | ItemKind::Use(..) => {
|
ItemKind::ExternCrate(..) | ItemKind::Use(..) => {
|
||||||
|
|
|
@ -176,7 +176,7 @@ fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item, trait_items
|
||||||
visited_trait.span,
|
visited_trait.span,
|
||||||
&format!(
|
&format!(
|
||||||
"trait `{}` has a `len` method but no (possibly inherited) `is_empty` method",
|
"trait `{}` has a `len` method but no (possibly inherited) `is_empty` method",
|
||||||
visited_trait.name
|
visited_trait.ident.name
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
|
||||||
hir::ItemKind::Enum(..) => "an enum",
|
hir::ItemKind::Enum(..) => "an enum",
|
||||||
hir::ItemKind::Fn(..) => {
|
hir::ItemKind::Fn(..) => {
|
||||||
// ignore main()
|
// ignore main()
|
||||||
if it.name == "main" {
|
if it.ident.name == "main" {
|
||||||
let def_id = cx.tcx.hir().local_def_id(it.id);
|
let def_id = cx.tcx.hir().local_def_id(it.id);
|
||||||
let def_key = cx.tcx.hir().def_key(def_id);
|
let def_key = cx.tcx.hir().def_key(def_id);
|
||||||
if def_key.parent == Some(hir::def_id::CRATE_DEF_INDEX) {
|
if def_key.parent == Some(hir::def_id::CRATE_DEF_INDEX) {
|
||||||
|
|
|
@ -355,7 +355,7 @@ fn print_expr(cx: &LateContext<'_, '_>, expr: &hir::Expr, indent: usize) {
|
||||||
|
|
||||||
fn print_item(cx: &LateContext<'_, '_>, item: &hir::Item) {
|
fn print_item(cx: &LateContext<'_, '_>, item: &hir::Item) {
|
||||||
let did = cx.tcx.hir().local_def_id(item.id);
|
let did = cx.tcx.hir().local_def_id(item.id);
|
||||||
println!("item `{}`", item.name);
|
println!("item `{}`", item.ident.name);
|
||||||
match item.vis.node {
|
match item.vis.node {
|
||||||
hir::VisibilityKind::Public => println!("public"),
|
hir::VisibilityKind::Public => println!("public"),
|
||||||
hir::VisibilityKind::Crate(_) => println!("visible crate wide"),
|
hir::VisibilityKind::Crate(_) => println!("visible crate wide"),
|
||||||
|
|
|
@ -154,7 +154,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LintWithoutLintPass {
|
||||||
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
|
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
|
||||||
if let hir::ItemKind::Static(ref ty, MutImmutable, _) = item.node {
|
if let hir::ItemKind::Static(ref ty, MutImmutable, _) = item.node {
|
||||||
if is_lint_ref_type(cx, ty) {
|
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 {
|
} else if let hir::ItemKind::Impl(.., Some(ref trait_ref), _, ref impl_item_refs) = item.node {
|
||||||
if_chain! {
|
if_chain! {
|
||||||
|
|
|
@ -334,7 +334,7 @@ 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> {
|
pub fn get_item_name(cx: &LateContext<'_, '_>, expr: &Expr) -> Option<Name> {
|
||||||
let parent_id = cx.tcx.hir().get_parent(expr.id);
|
let parent_id = cx.tcx.hir().get_parent(expr.id);
|
||||||
match cx.tcx.hir().find(parent_id) {
|
match cx.tcx.hir().find(parent_id) {
|
||||||
Some(Node::Item(&Item { ref name, .. })) => Some(*name),
|
Some(Node::Item(&Item { ref ident, .. })) => Some(ident.name),
|
||||||
Some(Node::TraitItem(&TraitItem { ident, .. })) | Some(Node::ImplItem(&ImplItem { ident, .. })) => {
|
Some(Node::TraitItem(&TraitItem { ident, .. })) | Some(Node::ImplItem(&ImplItem { ident, .. })) => {
|
||||||
Some(ident.name)
|
Some(ident.name)
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue