mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Rename span_lint_node* functions to span_lint_hir*
Because they now take a `hir_id` instead of a `node_id` argument.
This commit is contained in:
parent
1cdac4a9c7
commit
8a59f81180
@ -1,6 +1,6 @@
|
|||||||
use crate::utils::paths;
|
use crate::utils::paths;
|
||||||
use crate::utils::sugg::DiagnosticBuilderExt;
|
use crate::utils::sugg::DiagnosticBuilderExt;
|
||||||
use crate::utils::{get_trait_def_id, implements_trait, return_ty, same_tys, span_lint_node_and_then};
|
use crate::utils::{get_trait_def_id, implements_trait, return_ty, same_tys, span_lint_hir_and_then};
|
||||||
use if_chain::if_chain;
|
use if_chain::if_chain;
|
||||||
use rustc::hir;
|
use rustc::hir;
|
||||||
use rustc::hir::def_id::DefId;
|
use rustc::hir::def_id::DefId;
|
||||||
@ -163,7 +163,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Some(sp) = can_derive_default(self_ty, cx, default_trait_id) {
|
if let Some(sp) = can_derive_default(self_ty, cx, default_trait_id) {
|
||||||
span_lint_node_and_then(
|
span_lint_hir_and_then(
|
||||||
cx,
|
cx,
|
||||||
NEW_WITHOUT_DEFAULT,
|
NEW_WITHOUT_DEFAULT,
|
||||||
id,
|
id,
|
||||||
@ -182,7 +182,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
span_lint_node_and_then(
|
span_lint_hir_and_then(
|
||||||
cx,
|
cx,
|
||||||
NEW_WITHOUT_DEFAULT,
|
NEW_WITHOUT_DEFAULT,
|
||||||
id,
|
id,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::utils::{is_automatically_derived, span_lint_node};
|
use crate::utils::{is_automatically_derived, span_lint_hir};
|
||||||
use if_chain::if_chain;
|
use if_chain::if_chain;
|
||||||
use rustc::hir::*;
|
use rustc::hir::*;
|
||||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||||
@ -51,7 +51,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
|||||||
then {
|
then {
|
||||||
for impl_item in impl_items {
|
for impl_item in impl_items {
|
||||||
if impl_item.ident.name == "ne" {
|
if impl_item.ident.name == "ne" {
|
||||||
span_lint_node(
|
span_lint_hir(
|
||||||
cx,
|
cx,
|
||||||
PARTIALEQ_NE_IMPL,
|
PARTIALEQ_NE_IMPL,
|
||||||
impl_item.id.hir_id,
|
impl_item.id.hir_id,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::utils::{
|
use crate::utils::{
|
||||||
has_drop, in_macro, is_copy, match_def_path, match_type, paths, snippet_opt, span_lint_node,
|
has_drop, in_macro, is_copy, match_def_path, match_type, paths, snippet_opt, span_lint_hir,
|
||||||
span_lint_node_and_then, walk_ptrs_ty_depth,
|
span_lint_hir_and_then, walk_ptrs_ty_depth,
|
||||||
};
|
};
|
||||||
use if_chain::if_chain;
|
use if_chain::if_chain;
|
||||||
use matches::matches;
|
use matches::matches;
|
||||||
@ -199,7 +199,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {
|
|||||||
span.lo() + BytePos(u32::try_from(dot).unwrap())
|
span.lo() + BytePos(u32::try_from(dot).unwrap())
|
||||||
);
|
);
|
||||||
|
|
||||||
span_lint_node_and_then(cx, REDUNDANT_CLONE, node, sugg_span, "redundant clone", |db| {
|
span_lint_hir_and_then(cx, REDUNDANT_CLONE, node, sugg_span, "redundant clone", |db| {
|
||||||
db.span_suggestion(
|
db.span_suggestion(
|
||||||
sugg_span,
|
sugg_span,
|
||||||
"remove this",
|
"remove this",
|
||||||
@ -212,7 +212,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
span_lint_node(cx, REDUNDANT_CLONE, node, span, "redundant clone");
|
span_lint_hir(cx, REDUNDANT_CLONE, node, span, "redundant clone");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,19 +134,19 @@ pub fn span_lint_and_then<'a, 'tcx: 'a, T: LintContext<'tcx>, F>(
|
|||||||
db.docs_link(lint);
|
db.docs_link(lint);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn span_lint_node(cx: &LateContext<'_, '_>, lint: &'static Lint, node: HirId, sp: Span, msg: &str) {
|
pub fn span_lint_hir(cx: &LateContext<'_, '_>, lint: &'static Lint, hir_id: HirId, sp: Span, msg: &str) {
|
||||||
DiagnosticWrapper(cx.tcx.struct_span_lint_hir(lint, node, sp, msg)).docs_link(lint);
|
DiagnosticWrapper(cx.tcx.struct_span_lint_hir(lint, hir_id, sp, msg)).docs_link(lint);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn span_lint_node_and_then(
|
pub fn span_lint_hir_and_then(
|
||||||
cx: &LateContext<'_, '_>,
|
cx: &LateContext<'_, '_>,
|
||||||
lint: &'static Lint,
|
lint: &'static Lint,
|
||||||
node: HirId,
|
hir_id: HirId,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
msg: &str,
|
msg: &str,
|
||||||
f: impl FnOnce(&mut DiagnosticBuilder<'_>),
|
f: impl FnOnce(&mut DiagnosticBuilder<'_>),
|
||||||
) {
|
) {
|
||||||
let mut db = DiagnosticWrapper(cx.tcx.struct_span_lint_hir(lint, node, sp, msg));
|
let mut db = DiagnosticWrapper(cx.tcx.struct_span_lint_hir(lint, hir_id, sp, msg));
|
||||||
f(&mut db.0);
|
f(&mut db.0);
|
||||||
db.docs_link(lint);
|
db.docs_link(lint);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user