mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-05 11:33:04 +00:00
partially HirIdify lints
This commit is contained in:
parent
d61b25419b
commit
1fac380886
@ -7,7 +7,7 @@ use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
|||||||
use rustc::{declare_tool_lint, lint_array};
|
use rustc::{declare_tool_lint, lint_array};
|
||||||
use rustc_data_structures::thin_vec::ThinVec;
|
use rustc_data_structures::thin_vec::ThinVec;
|
||||||
use rustc_errors::Applicability;
|
use rustc_errors::Applicability;
|
||||||
use syntax::ast::{LitKind, NodeId, DUMMY_NODE_ID};
|
use syntax::ast::{LitKind, DUMMY_NODE_ID};
|
||||||
use syntax::source_map::{dummy_spanned, Span, DUMMY_SP};
|
use syntax::source_map::{dummy_spanned, Span, DUMMY_SP};
|
||||||
|
|
||||||
/// **What it does:** Checks for boolean expressions that can be written more
|
/// **What it does:** Checks for boolean expressions that can be written more
|
||||||
@ -72,7 +72,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonminimalBool {
|
|||||||
_: &'tcx FnDecl,
|
_: &'tcx FnDecl,
|
||||||
body: &'tcx Body,
|
body: &'tcx Body,
|
||||||
_: Span,
|
_: Span,
|
||||||
_: NodeId,
|
_: HirId,
|
||||||
) {
|
) {
|
||||||
NonminimalBoolVisitor { cx }.visit_body(body)
|
NonminimalBoolVisitor { cx }.visit_body(body)
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ use rustc::hir::*;
|
|||||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
use rustc::lint::{LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||||
use rustc::ty;
|
use rustc::ty;
|
||||||
use rustc::{declare_tool_lint, lint_array};
|
use rustc::{declare_tool_lint, lint_array};
|
||||||
use syntax::ast::{Attribute, NodeId};
|
use syntax::ast::Attribute;
|
||||||
use syntax::source_map::Span;
|
use syntax::source_map::Span;
|
||||||
|
|
||||||
use crate::utils::{in_macro, is_allowed, match_type, paths, span_help_and_lint, LimitStack};
|
use crate::utils::{in_macro, is_allowed, match_type, paths, span_help_and_lint, LimitStack};
|
||||||
@ -123,9 +123,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CyclomaticComplexity {
|
|||||||
_: &'tcx FnDecl,
|
_: &'tcx FnDecl,
|
||||||
body: &'tcx Body,
|
body: &'tcx Body,
|
||||||
span: Span,
|
span: Span,
|
||||||
node_id: NodeId,
|
hir_id: HirId,
|
||||||
) {
|
) {
|
||||||
let def_id = cx.tcx.hir().local_def_id(node_id);
|
let def_id = cx.tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||||
if !cx.tcx.has_attr(def_id, "test") {
|
if !cx.tcx.has_attr(def_id, "test") {
|
||||||
self.check(cx, body, span);
|
self.check(cx, body, span);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ use rustc::hir::def::Def;
|
|||||||
use rustc::hir::*;
|
use rustc::hir::*;
|
||||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||||
use rustc::{declare_tool_lint, lint_array};
|
use rustc::{declare_tool_lint, lint_array};
|
||||||
use syntax::ast::NodeId;
|
|
||||||
use syntax::source_map::Span;
|
use syntax::source_map::Span;
|
||||||
|
|
||||||
/// **What it does:** Checks for `use Enum::*`.
|
/// **What it does:** Checks for `use Enum::*`.
|
||||||
@ -39,7 +38,7 @@ impl LintPass for EnumGlobUse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EnumGlobUse {
|
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EnumGlobUse {
|
||||||
fn check_mod(&mut self, cx: &LateContext<'a, 'tcx>, m: &'tcx Mod, _: Span, _: NodeId) {
|
fn check_mod(&mut self, cx: &LateContext<'a, 'tcx>, m: &'tcx Mod, _: Span, _: HirId) {
|
||||||
// only check top level `use` statements
|
// only check top level `use` statements
|
||||||
for item in &m.item_ids {
|
for item in &m.item_ids {
|
||||||
self.lint_item(cx, cx.tcx.hir().expect_item(item.id));
|
self.lint_item(cx, cx.tcx.hir().expect_item(item.id));
|
||||||
|
@ -66,11 +66,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
|||||||
_: &'tcx FnDecl,
|
_: &'tcx FnDecl,
|
||||||
body: &'tcx Body,
|
body: &'tcx Body,
|
||||||
_: Span,
|
_: Span,
|
||||||
node_id: NodeId,
|
hir_id: HirId,
|
||||||
) {
|
) {
|
||||||
// If the method is an impl for a trait, don't warn
|
// If the method is an impl for a trait, don't warn
|
||||||
let parent_id = cx.tcx.hir().get_parent(node_id);
|
let parent_id = cx.tcx.hir().get_parent_item(hir_id);
|
||||||
let parent_node = cx.tcx.hir().find(parent_id);
|
let parent_node = cx.tcx.hir().find_by_hir_id(parent_id);
|
||||||
|
|
||||||
if let Some(Node::Item(item)) = parent_node {
|
if let Some(Node::Item(item)) = parent_node {
|
||||||
if let ItemKind::Impl(_, _, _, _, Some(..), _, _) = item.node {
|
if let ItemKind::Impl(_, _, _, _, Some(..), _, _) = item.node {
|
||||||
@ -84,7 +84,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
|||||||
too_large_for_stack: self.too_large_for_stack,
|
too_large_for_stack: self.too_large_for_stack,
|
||||||
};
|
};
|
||||||
|
|
||||||
let fn_def_id = cx.tcx.hir().local_def_id(node_id);
|
let fn_def_id = cx.tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||||
let region_scope_tree = &cx.tcx.region_scope_tree(fn_def_id);
|
let region_scope_tree = &cx.tcx.region_scope_tree(fn_def_id);
|
||||||
ExprUseVisitor::new(&mut v, cx.tcx, cx.param_env, region_scope_tree, cx.tables, None).consume_body(body);
|
ExprUseVisitor::new(&mut v, cx.tcx, cx.param_env, region_scope_tree, cx.tables, None).consume_body(body);
|
||||||
|
|
||||||
|
@ -112,9 +112,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
|
|||||||
decl: &'tcx hir::FnDecl,
|
decl: &'tcx hir::FnDecl,
|
||||||
body: &'tcx hir::Body,
|
body: &'tcx hir::Body,
|
||||||
span: Span,
|
span: Span,
|
||||||
nodeid: ast::NodeId,
|
hir_id: hir::HirId,
|
||||||
) {
|
) {
|
||||||
let is_impl = if let Some(hir::Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_node(nodeid)) {
|
let is_impl = if let Some(hir::Node::Item(item)) = cx.tcx.hir().find_by_hir_id(
|
||||||
|
cx.tcx.hir().get_parent_node_by_hir_id(hir_id))
|
||||||
|
{
|
||||||
matches!(item.node, hir::ItemKind::Impl(_, _, _, _, Some(_), _, _))
|
matches!(item.node, hir::ItemKind::Impl(_, _, _, _, Some(_), _, _))
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
@ -146,6 +148,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let nodeid = cx.tcx.hir().hir_to_node_id(hir_id);
|
||||||
self.check_raw_ptr(cx, unsafety, decl, body, nodeid);
|
self.check_raw_ptr(cx, unsafety, decl, body, nodeid);
|
||||||
self.check_line_number(cx, span);
|
self.check_line_number(cx, span);
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use crate::utils::{in_macro, is_expn_of, snippet_opt, span_lint_and_then};
|
use crate::utils::{in_macro, is_expn_of, snippet_opt, span_lint_and_then};
|
||||||
use rustc::hir::{intravisit::FnKind, Body, ExprKind, FnDecl, MatchSource};
|
use rustc::hir::{intravisit::FnKind, Body, ExprKind, FnDecl, HirId, MatchSource};
|
||||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||||
use rustc::{declare_tool_lint, lint_array};
|
use rustc::{declare_tool_lint, lint_array};
|
||||||
use rustc_errors::Applicability;
|
use rustc_errors::Applicability;
|
||||||
use syntax::{ast::NodeId, source_map::Span};
|
use syntax::source_map::Span;
|
||||||
|
|
||||||
/// **What it does:** Checks for missing return statements at the end of a block.
|
/// **What it does:** Checks for missing return statements at the end of a block.
|
||||||
///
|
///
|
||||||
@ -128,7 +128,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
|||||||
_: &'tcx FnDecl,
|
_: &'tcx FnDecl,
|
||||||
body: &'tcx Body,
|
body: &'tcx Body,
|
||||||
span: Span,
|
span: Span,
|
||||||
_: NodeId,
|
_: HirId,
|
||||||
) {
|
) {
|
||||||
let def_id = cx.tcx.hir().body_owner_def_id(body.id());
|
let def_id = cx.tcx.hir().body_owner_def_id(body.id());
|
||||||
let mir = cx.tcx.optimized_mir(def_id);
|
let mir = cx.tcx.optimized_mir(def_id);
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use crate::consts::{constant, Constant};
|
use crate::consts::{constant, Constant};
|
||||||
use crate::reexport::*;
|
|
||||||
use crate::utils::sugg::Sugg;
|
use crate::utils::sugg::Sugg;
|
||||||
use crate::utils::{
|
use crate::utils::{
|
||||||
get_item_name, get_parent_expr, implements_trait, in_constant, in_macro, is_integer_literal, iter_input_pats,
|
get_item_name, get_parent_expr, implements_trait, in_constant, in_macro, is_integer_literal, iter_input_pats,
|
||||||
@ -256,7 +255,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
|||||||
decl: &'tcx FnDecl,
|
decl: &'tcx FnDecl,
|
||||||
body: &'tcx Body,
|
body: &'tcx Body,
|
||||||
_: Span,
|
_: Span,
|
||||||
_: NodeId,
|
_: HirId,
|
||||||
) {
|
) {
|
||||||
if let FnKind::Closure(_) = k {
|
if let FnKind::Closure(_) = k {
|
||||||
// Does not apply to closures
|
// Does not apply to closures
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
use crate::utils::{is_entrypoint_fn, span_lint};
|
use crate::utils::{is_entrypoint_fn, span_lint};
|
||||||
use rustc::hir;
|
use rustc::hir;
|
||||||
use rustc::hir::intravisit::FnKind;
|
use rustc::hir::intravisit::FnKind;
|
||||||
use rustc::hir::{Body, Constness, FnDecl};
|
use rustc::hir::{Body, Constness, FnDecl, HirId};
|
||||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||||
use rustc::{declare_tool_lint, lint_array};
|
use rustc::{declare_tool_lint, lint_array};
|
||||||
use rustc_mir::transform::qualify_min_const_fn::is_min_const_fn;
|
use rustc_mir::transform::qualify_min_const_fn::is_min_const_fn;
|
||||||
use syntax::ast::NodeId;
|
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
|
|
||||||
/// **What it does:**
|
/// **What it does:**
|
||||||
@ -79,9 +78,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingConstForFn {
|
|||||||
_: &FnDecl,
|
_: &FnDecl,
|
||||||
_: &Body,
|
_: &Body,
|
||||||
span: Span,
|
span: Span,
|
||||||
node_id: NodeId,
|
hir_id: HirId,
|
||||||
) {
|
) {
|
||||||
let def_id = cx.tcx.hir().local_def_id(node_id);
|
let def_id = cx.tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||||
|
|
||||||
if is_entrypoint_fn(cx, def_id) {
|
if is_entrypoint_fn(cx, def_id) {
|
||||||
return;
|
return;
|
||||||
|
@ -81,7 +81,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
|
|||||||
decl: &'tcx FnDecl,
|
decl: &'tcx FnDecl,
|
||||||
body: &'tcx Body,
|
body: &'tcx Body,
|
||||||
span: Span,
|
span: Span,
|
||||||
node_id: NodeId,
|
hir_id: HirId,
|
||||||
) {
|
) {
|
||||||
if in_macro(span) {
|
if in_macro(span) {
|
||||||
return;
|
return;
|
||||||
@ -103,7 +103,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Exclude non-inherent impls
|
// Exclude non-inherent impls
|
||||||
if let Some(Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_node(node_id)) {
|
if let Some(Node::Item(item)) = cx.tcx.hir().find_by_hir_id(
|
||||||
|
cx.tcx.hir().get_parent_node_by_hir_id(hir_id))
|
||||||
|
{
|
||||||
if matches!(item.node, ItemKind::Impl(_, _, _, _, Some(_), _, _) |
|
if matches!(item.node, ItemKind::Impl(_, _, _, _, Some(_), _, _) |
|
||||||
ItemKind::Trait(..))
|
ItemKind::Trait(..))
|
||||||
{
|
{
|
||||||
@ -122,7 +124,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
|
|||||||
|
|
||||||
let sized_trait = need!(cx.tcx.lang_items().sized_trait());
|
let sized_trait = need!(cx.tcx.lang_items().sized_trait());
|
||||||
|
|
||||||
let fn_def_id = cx.tcx.hir().local_def_id(node_id);
|
let fn_def_id = cx.tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||||
|
|
||||||
let preds = traits::elaborate_predicates(cx.tcx, cx.param_env.caller_bounds.to_vec())
|
let preds = traits::elaborate_predicates(cx.tcx, cx.param_env.caller_bounds.to_vec())
|
||||||
.filter(|p| !p.is_global())
|
.filter(|p| !p.is_global())
|
||||||
|
@ -5,7 +5,7 @@ use crate::utils::{
|
|||||||
use if_chain::if_chain;
|
use if_chain::if_chain;
|
||||||
use matches::matches;
|
use matches::matches;
|
||||||
use rustc::hir::intravisit::FnKind;
|
use rustc::hir::intravisit::FnKind;
|
||||||
use rustc::hir::{def_id, Body, FnDecl};
|
use rustc::hir::{def_id, Body, FnDecl, HirId};
|
||||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||||
use rustc::mir::{
|
use rustc::mir::{
|
||||||
self, traversal,
|
self, traversal,
|
||||||
@ -17,7 +17,6 @@ use rustc::{declare_tool_lint, lint_array};
|
|||||||
use rustc_errors::Applicability;
|
use rustc_errors::Applicability;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use syntax::{
|
use syntax::{
|
||||||
ast::NodeId,
|
|
||||||
source_map::{BytePos, Span},
|
source_map::{BytePos, Span},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -88,7 +87,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {
|
|||||||
_: &'tcx FnDecl,
|
_: &'tcx FnDecl,
|
||||||
body: &'tcx Body,
|
body: &'tcx Body,
|
||||||
_: Span,
|
_: Span,
|
||||||
_: NodeId,
|
_: HirId,
|
||||||
) {
|
) {
|
||||||
let def_id = cx.tcx.hir().body_owner_def_id(body.id());
|
let def_id = cx.tcx.hir().body_owner_def_id(body.id());
|
||||||
let mir = cx.tcx.optimized_mir(def_id);
|
let mir = cx.tcx.optimized_mir(def_id);
|
||||||
|
@ -96,7 +96,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
|||||||
decl: &'tcx FnDecl,
|
decl: &'tcx FnDecl,
|
||||||
body: &'tcx Body,
|
body: &'tcx Body,
|
||||||
_: Span,
|
_: Span,
|
||||||
_: NodeId,
|
_: HirId,
|
||||||
) {
|
) {
|
||||||
if in_external_macro(cx.sess(), body.value.span) {
|
if in_external_macro(cx.sess(), body.value.span) {
|
||||||
return;
|
return;
|
||||||
|
@ -13,7 +13,6 @@ use rustc::{declare_tool_lint, lint_array};
|
|||||||
use rustc_errors::Applicability;
|
use rustc_errors::Applicability;
|
||||||
use rustc_target::abi::LayoutOf;
|
use rustc_target::abi::LayoutOf;
|
||||||
use rustc_target::spec::abi::Abi;
|
use rustc_target::spec::abi::Abi;
|
||||||
use syntax::ast::NodeId;
|
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
|
|
||||||
/// **What it does:** Checks for functions taking arguments by reference, where
|
/// **What it does:** Checks for functions taking arguments by reference, where
|
||||||
@ -165,7 +164,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TriviallyCopyPassByRef {
|
|||||||
decl: &'tcx FnDecl,
|
decl: &'tcx FnDecl,
|
||||||
_body: &'tcx Body,
|
_body: &'tcx Body,
|
||||||
span: Span,
|
span: Span,
|
||||||
node_id: NodeId,
|
hir_id: HirId,
|
||||||
) {
|
) {
|
||||||
if in_macro(span) {
|
if in_macro(span) {
|
||||||
return;
|
return;
|
||||||
@ -187,7 +186,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TriviallyCopyPassByRef {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Exclude non-inherent impls
|
// Exclude non-inherent impls
|
||||||
if let Some(Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_node(node_id)) {
|
if let Some(Node::Item(item)) = cx.tcx.hir().find_by_hir_id(
|
||||||
|
cx.tcx.hir().get_parent_node_by_hir_id(hir_id))
|
||||||
|
{
|
||||||
if matches!(item.node, ItemKind::Impl(_, _, _, _, Some(_), _, _) |
|
if matches!(item.node, ItemKind::Impl(_, _, _, _, Some(_), _, _) |
|
||||||
ItemKind::Trait(..))
|
ItemKind::Trait(..))
|
||||||
{
|
{
|
||||||
@ -195,7 +196,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TriviallyCopyPassByRef {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let fn_def_id = cx.tcx.hir().local_def_id(node_id);
|
let fn_def_id = cx.tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||||
|
|
||||||
let fn_sig = cx.tcx.fn_sig(fn_def_id);
|
let fn_sig = cx.tcx.fn_sig(fn_def_id);
|
||||||
let fn_sig = cx.tcx.erase_late_bound_regions(&fn_sig);
|
let fn_sig = cx.tcx.erase_late_bound_regions(&fn_sig);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#![allow(clippy::default_hash_types)]
|
#![allow(clippy::default_hash_types)]
|
||||||
|
|
||||||
use crate::consts::{constant, Constant};
|
use crate::consts::{constant, Constant};
|
||||||
use crate::reexport::*;
|
|
||||||
use crate::utils::paths;
|
use crate::utils::paths;
|
||||||
use crate::utils::{
|
use crate::utils::{
|
||||||
clip, comparisons, differing_macro_contexts, higher, in_constant, in_macro, int_bits, last_path_segment,
|
clip, comparisons, differing_macro_contexts, higher, in_constant, in_macro, int_bits, last_path_segment,
|
||||||
@ -175,9 +174,19 @@ impl LintPass for TypePass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypePass {
|
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypePass {
|
||||||
fn check_fn(&mut self, cx: &LateContext<'_, '_>, _: FnKind<'_>, decl: &FnDecl, _: &Body, _: Span, id: NodeId) {
|
fn check_fn(
|
||||||
|
&mut self,
|
||||||
|
cx: &LateContext<'_, '_>,
|
||||||
|
_: FnKind<'_>,
|
||||||
|
decl: &FnDecl,
|
||||||
|
_: &Body,
|
||||||
|
_: Span,
|
||||||
|
id: HirId,
|
||||||
|
) {
|
||||||
// skip trait implementations, see #605
|
// skip trait implementations, see #605
|
||||||
if let Some(hir::Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent(id)) {
|
if let Some(hir::Node::Item(item)) = cx.tcx.hir().find_by_hir_id(
|
||||||
|
cx.tcx.hir().get_parent_item(id))
|
||||||
|
{
|
||||||
if let ItemKind::Impl(_, _, _, _, Some(..), _, _) = item.node {
|
if let ItemKind::Impl(_, _, _, _, Some(..), _, _) = item.node {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1336,7 +1345,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeComplexityPass {
|
|||||||
decl: &'tcx FnDecl,
|
decl: &'tcx FnDecl,
|
||||||
_: &'tcx Body,
|
_: &'tcx Body,
|
||||||
_: Span,
|
_: Span,
|
||||||
_: NodeId,
|
_: HirId,
|
||||||
) {
|
) {
|
||||||
self.check_fndecl(cx, decl);
|
self.check_fndecl(cx, decl);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ use rustc::hir::intravisit::{walk_expr, walk_fn, FnKind, NestedVisitorMap, Visit
|
|||||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||||
use rustc::{declare_tool_lint, lint_array};
|
use rustc::{declare_tool_lint, lint_array};
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
use syntax::ast;
|
|
||||||
use syntax::source_map::Span;
|
use syntax::source_map::Span;
|
||||||
use syntax::symbol::LocalInternedString;
|
use syntax::symbol::LocalInternedString;
|
||||||
|
|
||||||
@ -53,7 +52,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedLabel {
|
|||||||
decl: &'tcx hir::FnDecl,
|
decl: &'tcx hir::FnDecl,
|
||||||
body: &'tcx hir::Body,
|
body: &'tcx hir::Body,
|
||||||
span: Span,
|
span: Span,
|
||||||
fn_id: ast::NodeId,
|
fn_id: hir::HirId,
|
||||||
) {
|
) {
|
||||||
if in_macro(span) {
|
if in_macro(span) {
|
||||||
return;
|
return;
|
||||||
|
@ -5,7 +5,6 @@ use rustc::{declare_tool_lint, lint_array};
|
|||||||
use crate::utils::{in_macro, match_type, paths, span_lint_and_then, usage::is_potentially_mutated};
|
use crate::utils::{in_macro, match_type, paths, span_lint_and_then, usage::is_potentially_mutated};
|
||||||
use rustc::hir::intravisit::*;
|
use rustc::hir::intravisit::*;
|
||||||
use rustc::hir::*;
|
use rustc::hir::*;
|
||||||
use syntax::ast::NodeId;
|
|
||||||
use syntax::source_map::Span;
|
use syntax::source_map::Span;
|
||||||
|
|
||||||
/// **What it does:** Checks for calls of `unwrap[_err]()` that cannot fail.
|
/// **What it does:** Checks for calls of `unwrap[_err]()` that cannot fail.
|
||||||
@ -198,7 +197,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
|||||||
decl: &'tcx FnDecl,
|
decl: &'tcx FnDecl,
|
||||||
body: &'tcx Body,
|
body: &'tcx Body,
|
||||||
span: Span,
|
span: Span,
|
||||||
fn_id: NodeId,
|
fn_id: HirId,
|
||||||
) {
|
) {
|
||||||
if in_macro(span) {
|
if in_macro(span) {
|
||||||
return;
|
return;
|
||||||
|
@ -8,7 +8,7 @@ use rustc::hir::{BindingAnnotation, Expr, ExprKind, Pat, PatKind, QPath, Stmt, S
|
|||||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||||
use rustc::{declare_tool_lint, lint_array};
|
use rustc::{declare_tool_lint, lint_array};
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
use syntax::ast::{Attribute, LitKind, DUMMY_NODE_ID};
|
use syntax::ast::{Attribute, LitKind};
|
||||||
|
|
||||||
/// **What it does:** Generates clippy code that detects the offending pattern
|
/// **What it does:** Generates clippy code that detects the offending pattern
|
||||||
///
|
///
|
||||||
@ -103,7 +103,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
prelude();
|
prelude();
|
||||||
PrintVisitor::new("var").visit_variant(var, generics, DUMMY_NODE_ID);
|
PrintVisitor::new("var").visit_variant(var, generics, hir::DUMMY_HIR_ID);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user