Rename LintContext::emit_spanned_lint
as LintContext::emit_span_lint
.
This commit is contained in:
parent
c915e90f7e
commit
1881bfaa2b
@ -132,7 +132,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) {
|
||||
} else {
|
||||
None
|
||||
};
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
ARRAY_INTO_ITER,
|
||||
call.ident.span,
|
||||
ArrayIntoIterDiag { target, suggestion: call.ident.span, sub },
|
||||
|
@ -121,7 +121,7 @@ fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) {
|
||||
"{}loop",
|
||||
label.map_or_else(String::new, |label| format!("{}: ", label.ident,))
|
||||
);
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
WHILE_TRUE,
|
||||
condition_span,
|
||||
BuiltinWhileTrue { suggestion: condition_span, replace },
|
||||
@ -162,7 +162,7 @@ fn check_heap_type(&self, cx: &LateContext<'_>, span: Span, ty: Ty<'_>) {
|
||||
if let GenericArgKind::Type(leaf_ty) = leaf.unpack()
|
||||
&& leaf_ty.is_box()
|
||||
{
|
||||
cx.emit_spanned_lint(BOX_POINTERS, span, BuiltinBoxPointers { ty });
|
||||
cx.emit_span_lint(BOX_POINTERS, span, BuiltinBoxPointers { ty });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -265,7 +265,7 @@ fn check_pat(&mut self, cx: &LateContext<'_>, pat: &hir::Pat<'_>) {
|
||||
if cx.tcx.find_field_index(ident, variant)
|
||||
== Some(cx.typeck_results().field_index(fieldpat.hir_id))
|
||||
{
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
NON_SHORTHAND_FIELD_PATTERNS,
|
||||
fieldpat.span,
|
||||
BuiltinNonShorthandFieldPatterns {
|
||||
@ -334,7 +334,7 @@ fn report_unsafe(
|
||||
return;
|
||||
}
|
||||
|
||||
cx.emit_spanned_lint(UNSAFE_CODE, span, decorate);
|
||||
cx.emit_span_lint(UNSAFE_CODE, span, decorate);
|
||||
}
|
||||
}
|
||||
|
||||
@ -509,7 +509,7 @@ fn check_missing_docs_attrs(
|
||||
let attrs = cx.tcx.hir().attrs(cx.tcx.local_def_id_to_hir_id(def_id));
|
||||
let has_doc = attrs.iter().any(has_doc);
|
||||
if !has_doc {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
MISSING_DOCS,
|
||||
cx.tcx.def_span(def_id),
|
||||
BuiltinMissingDoc { article, desc },
|
||||
@ -710,7 +710,7 @@ fn check_item(&mut self, cx: &LateContext<'_>, item: &hir::Item<'_>) {
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
cx.emit_spanned_lint(MISSING_COPY_IMPLEMENTATIONS, item.span, BuiltinMissingCopyImpl);
|
||||
cx.emit_span_lint(MISSING_COPY_IMPLEMENTATIONS, item.span, BuiltinMissingCopyImpl);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -795,7 +795,7 @@ fn check_item(&mut self, cx: &LateContext<'_>, item: &hir::Item<'_>) {
|
||||
.next()
|
||||
.is_some();
|
||||
if !has_impl {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
MISSING_DEBUG_IMPLEMENTATIONS,
|
||||
item.span,
|
||||
BuiltinMissingDebugImpl { tcx: cx.tcx, def_id: debug },
|
||||
@ -874,7 +874,7 @@ fn check_trait_item(&mut self, cx: &EarlyContext<'_>, it: &ast::AssocItem) {
|
||||
} else {
|
||||
("<type>", Applicability::HasPlaceholders)
|
||||
};
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
ANONYMOUS_PARAMETERS,
|
||||
arg.pat.span,
|
||||
BuiltinAnonymousParams { suggestion: (arg.pat.span, appl), ty_snip },
|
||||
@ -921,7 +921,7 @@ fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &ast::Attribute) {
|
||||
BuiltinDeprecatedAttrLinkSuggestion::Default { suggestion: attr.span }
|
||||
}
|
||||
};
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
DEPRECATED,
|
||||
attr.span,
|
||||
BuiltinDeprecatedAttrLink { name, reason, link, suggestion },
|
||||
@ -931,7 +931,7 @@ fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &ast::Attribute) {
|
||||
}
|
||||
}
|
||||
if attr.has_name(sym::no_start) || attr.has_name(sym::crate_id) {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
DEPRECATED,
|
||||
attr.span,
|
||||
BuiltinDeprecatedAttrUsed {
|
||||
@ -973,7 +973,7 @@ fn warn_if_doc(cx: &EarlyContext<'_>, node_span: Span, node_kind: &str, attrs: &
|
||||
BuiltinUnusedDocCommentSub::BlockHelp
|
||||
}
|
||||
};
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
UNUSED_DOC_COMMENTS,
|
||||
span,
|
||||
BuiltinUnusedDocComment { kind: node_kind, label: node_span, sub },
|
||||
@ -1107,7 +1107,7 @@ fn check_item(&mut self, cx: &LateContext<'_>, it: &hir::Item<'_>) {
|
||||
match param.kind {
|
||||
GenericParamKind::Lifetime { .. } => {}
|
||||
GenericParamKind::Type { .. } | GenericParamKind::Const { .. } => {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
NO_MANGLE_GENERIC_ITEMS,
|
||||
span,
|
||||
BuiltinNoMangleGeneric { suggestion: no_mangle_attr.span },
|
||||
@ -1138,7 +1138,7 @@ fn check_item(&mut self, cx: &LateContext<'_>, it: &hir::Item<'_>) {
|
||||
|
||||
// Const items do not refer to a particular location in memory, and therefore
|
||||
// don't have anything to attach a symbol to
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
NO_MANGLE_CONST_ITEMS,
|
||||
it.span,
|
||||
BuiltinConstNoMangle { suggestion },
|
||||
@ -1201,7 +1201,7 @@ fn check_expr(&mut self, cx: &LateContext<'_>, expr: &hir::Expr<'_>) {
|
||||
get_transmute_from_to(cx, expr).map(|(ty1, ty2)| (ty1.kind(), ty2.kind()))
|
||||
{
|
||||
if from_mutbl < to_mutbl {
|
||||
cx.emit_spanned_lint(MUTABLE_TRANSMUTES, expr.span, BuiltinMutablesTransmutes);
|
||||
cx.emit_span_lint(MUTABLE_TRANSMUTES, expr.span, BuiltinMutablesTransmutes);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1270,7 +1270,7 @@ fn check_attribute(&mut self, cx: &LateContext<'_>, attr: &ast::Attribute) {
|
||||
&& let Some(items) = attr.meta_item_list()
|
||||
{
|
||||
for item in items {
|
||||
cx.emit_spanned_lint(UNSTABLE_FEATURES, item.span(), BuiltinUnstableFeatures);
|
||||
cx.emit_span_lint(UNSTABLE_FEATURES, item.span(), BuiltinUnstableFeatures);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1323,7 +1323,7 @@ fn check_fn(
|
||||
// Now, check if the function has the `#[track_caller]` attribute
|
||||
&& let Some(attr) = cx.tcx.get_attr(def_id, sym::track_caller)
|
||||
{
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
UNGATED_ASYNC_FN_TRACK_CALLER,
|
||||
attr.span,
|
||||
BuiltinUngatedAsyncFnTrackCaller { label: span, session: &cx.tcx.sess },
|
||||
@ -1389,7 +1389,7 @@ fn perform_lint(
|
||||
applicability = Applicability::MaybeIncorrect;
|
||||
}
|
||||
let def_span = cx.tcx.def_span(def_id);
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
UNREACHABLE_PUB,
|
||||
def_span,
|
||||
BuiltinUnreachablePub {
|
||||
@ -1518,7 +1518,7 @@ fn check_item(&mut self, cx: &LateContext<'_>, item: &hir::Item<'_>) {
|
||||
suggested_changing_assoc_types = true;
|
||||
SuggestChangingAssocTypes { ty: hir_ty }
|
||||
});
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
TYPE_ALIAS_BOUNDS,
|
||||
where_spans,
|
||||
BuiltinTypeAliasWhereClause {
|
||||
@ -1534,7 +1534,7 @@ fn check_item(&mut self, cx: &LateContext<'_>, item: &hir::Item<'_>) {
|
||||
suggested_changing_assoc_types = true;
|
||||
SuggestChangingAssocTypes { ty: hir_ty }
|
||||
});
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
TYPE_ALIAS_BOUNDS,
|
||||
inline_spans,
|
||||
BuiltinTypeAliasGenericBounds { suggestion, sub },
|
||||
@ -1633,7 +1633,7 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) {
|
||||
| ClauseKind::ConstEvaluatable(..) => continue,
|
||||
};
|
||||
if predicate.is_global() {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
TRIVIAL_BOUNDS,
|
||||
span,
|
||||
BuiltinTrivialBounds { predicate_kind_name, predicate },
|
||||
@ -1751,7 +1751,7 @@ fn matches_ellipsis_pat(pat: &ast::Pat) -> Option<(Option<&Expr>, &Expr, Span)>
|
||||
replace,
|
||||
});
|
||||
} else {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
ELLIPSIS_INCLUSIVE_RANGE_PATTERNS,
|
||||
pat.span,
|
||||
BuiltinEllipsisInclusiveRangePatternsLint::Parenthesise {
|
||||
@ -1769,7 +1769,7 @@ fn matches_ellipsis_pat(pat: &ast::Pat) -> Option<(Option<&Expr>, &Expr, Span)>
|
||||
replace: replace.to_string(),
|
||||
});
|
||||
} else {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
ELLIPSIS_INCLUSIVE_RANGE_PATTERNS,
|
||||
join,
|
||||
BuiltinEllipsisInclusiveRangePatternsLint::NonParenthesise {
|
||||
@ -1895,7 +1895,7 @@ fn check_ident_token(
|
||||
return;
|
||||
}
|
||||
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
KEYWORD_IDENTS,
|
||||
ident.span,
|
||||
BuiltinKeywordIdents { kw: ident, next: next_edition, suggestion: ident.span },
|
||||
@ -2203,7 +2203,7 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) {
|
||||
lint_spans.sort_unstable();
|
||||
lint_spans.dedup();
|
||||
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
EXPLICIT_OUTLIVES_REQUIREMENTS,
|
||||
lint_spans.clone(),
|
||||
BuiltinExplicitOutlives {
|
||||
@ -2290,13 +2290,13 @@ fn check_crate(&mut self, cx: &EarlyContext<'_>, _: &ast::Crate) {
|
||||
let help =
|
||||
HAS_MIN_FEATURES.contains(&name).then_some(BuiltinIncompleteFeaturesHelp);
|
||||
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
INCOMPLETE_FEATURES,
|
||||
span,
|
||||
BuiltinIncompleteFeatures { name, note, help },
|
||||
);
|
||||
} else {
|
||||
cx.emit_spanned_lint(INTERNAL_FEATURES, span, BuiltinInternalFeatures { name });
|
||||
cx.emit_span_lint(INTERNAL_FEATURES, span, BuiltinInternalFeatures { name });
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -2612,7 +2612,7 @@ fn ty_find_init_error<'tcx>(
|
||||
InitKind::Uninit => fluent::lint_builtin_unpermitted_type_init_uninit,
|
||||
};
|
||||
let sub = BuiltinUnpermittedTypeInitSub { err };
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
INVALID_VALUE,
|
||||
expr.span,
|
||||
BuiltinUnpermittedTypeInit {
|
||||
@ -2700,7 +2700,7 @@ fn is_zero(expr: &hir::Expr<'_>) -> bool {
|
||||
|
||||
if let rustc_hir::ExprKind::Unary(rustc_hir::UnOp::Deref, expr_deref) = expr.kind {
|
||||
if is_null_ptr(cx, expr_deref) {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
DEREF_NULLPTR,
|
||||
expr.span,
|
||||
BuiltinDerefNullptr { label: expr.span },
|
||||
@ -2925,12 +2925,12 @@ fn check_crate(&mut self, cx: &EarlyContext<'_>, krate: &ast::Crate) {
|
||||
}
|
||||
|
||||
match item.ident.name.as_str() {
|
||||
"lib" => cx.emit_spanned_lint(
|
||||
"lib" => cx.emit_span_lint(
|
||||
SPECIAL_MODULE_NAME,
|
||||
item.span,
|
||||
BuiltinSpecialModuleNameUsed::Lib,
|
||||
),
|
||||
"main" => cx.emit_spanned_lint(
|
||||
"main" => cx.emit_span_lint(
|
||||
SPECIAL_MODULE_NAME,
|
||||
item.span,
|
||||
BuiltinSpecialModuleNameUsed::Main,
|
||||
|
@ -565,7 +565,7 @@ fn opt_span_lint<S: Into<MultiSpan>>(
|
||||
|
||||
/// Emit a lint at `span` from a lint struct (some type that implements `DecorateLint`,
|
||||
/// typically generated by `#[derive(LintDiagnostic)]`).
|
||||
fn emit_spanned_lint<S: Into<MultiSpan>>(
|
||||
fn emit_span_lint<S: Into<MultiSpan>>(
|
||||
&self,
|
||||
lint: &'static Lint,
|
||||
span: S,
|
||||
|
@ -78,7 +78,7 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) {
|
||||
.find_map(|i| (i.ident.name == sym::Target).then_some(i.span))
|
||||
.map(|label| SupertraitAsDerefTargetLabel { label });
|
||||
let span = tcx.def_span(item.owner_id.def_id);
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
DEREF_INTO_DYN_SUPERTRAIT,
|
||||
span,
|
||||
SupertraitAsDerefTarget {
|
||||
|
@ -149,28 +149,28 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
|
||||
let drop_is_single_call_in_arm = is_single_call_in_arm(cx, arg, expr);
|
||||
match fn_name {
|
||||
sym::mem_drop if arg_ty.is_ref() && !drop_is_single_call_in_arm => {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
DROPPING_REFERENCES,
|
||||
expr.span,
|
||||
DropRefDiag { arg_ty, label: arg.span },
|
||||
);
|
||||
}
|
||||
sym::mem_forget if arg_ty.is_ref() => {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
FORGETTING_REFERENCES,
|
||||
expr.span,
|
||||
ForgetRefDiag { arg_ty, label: arg.span },
|
||||
);
|
||||
}
|
||||
sym::mem_drop if is_copy && !drop_is_single_call_in_arm => {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
DROPPING_COPY_TYPES,
|
||||
expr.span,
|
||||
DropCopyDiag { arg_ty, label: arg.span },
|
||||
);
|
||||
}
|
||||
sym::mem_forget if is_copy => {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
FORGETTING_COPY_TYPES,
|
||||
expr.span,
|
||||
ForgetCopyDiag { arg_ty, label: arg.span },
|
||||
@ -180,7 +180,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
|
||||
if let ty::Adt(adt, _) = arg_ty.kind()
|
||||
&& adt.is_manually_drop() =>
|
||||
{
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
UNDROPPED_MANUALLY_DROPS,
|
||||
expr.span,
|
||||
UndroppedManuallyDropsDiag {
|
||||
|
@ -53,7 +53,7 @@ fn enforce_mem_discriminant(
|
||||
) {
|
||||
let ty_param = cx.typeck_results().node_args(func_expr.hir_id).type_at(0);
|
||||
if is_non_enum(ty_param) {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
ENUM_INTRINSICS_NON_ENUMS,
|
||||
expr_span,
|
||||
EnumIntrinsicsMemDiscriminate { ty_param, note: args_span },
|
||||
@ -64,11 +64,7 @@ fn enforce_mem_discriminant(
|
||||
fn enforce_mem_variant_count(cx: &LateContext<'_>, func_expr: &hir::Expr<'_>, span: Span) {
|
||||
let ty_param = cx.typeck_results().node_args(func_expr.hir_id).type_at(0);
|
||||
if is_non_enum(ty_param) {
|
||||
cx.emit_spanned_lint(
|
||||
ENUM_INTRINSICS_NON_ENUMS,
|
||||
span,
|
||||
EnumIntrinsicsMemVariant { ty_param },
|
||||
);
|
||||
cx.emit_span_lint(ENUM_INTRINSICS_NON_ENUMS, span, EnumIntrinsicsMemVariant { ty_param });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
|
||||
end_span: pat.span.between(arg.span),
|
||||
};
|
||||
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
FOR_LOOPS_OVER_FALLIBLES,
|
||||
arg.span,
|
||||
ForLoopsOverFalliblesDiag { article, ty, sub, question_mark, suggestion },
|
||||
|
@ -74,7 +74,7 @@ fn lint_text_direction_codepoint(
|
||||
HiddenUnicodeCodepointsDiagSub::NoEscape { spans }
|
||||
};
|
||||
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
TEXT_DIRECTION_CODEPOINT_IN_LITERAL,
|
||||
span,
|
||||
HiddenUnicodeCodepointsDiag { label, count, span_label: span, labels, sub },
|
||||
|
@ -43,7 +43,7 @@ fn check_path(&mut self, cx: &LateContext<'_>, path: &Path<'_>, hir_id: HirId) {
|
||||
Some(sym::HashSet) => "FxHashSet",
|
||||
_ => return,
|
||||
};
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
DEFAULT_HASH_TYPES,
|
||||
path.span,
|
||||
DefaultHashTypesDiag { preferred, used: cx.tcx.item_name(def_id) },
|
||||
@ -91,7 +91,7 @@ fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
|
||||
if let Ok(Some(instance)) = ty::Instance::resolve(cx.tcx, cx.param_env, def_id, args) {
|
||||
let def_id = instance.def_id();
|
||||
if cx.tcx.has_attr(def_id, sym::rustc_lint_query_instability) {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
POTENTIAL_QUERY_INSTABILITY,
|
||||
span,
|
||||
QueryInstability { query: cx.tcx.item_name(def_id) },
|
||||
@ -136,7 +136,7 @@ fn check_path(
|
||||
{
|
||||
let span =
|
||||
path.span.with_hi(segment.args.map_or(segment.ident.span, |a| a.span_ext).hi());
|
||||
cx.emit_spanned_lint(USAGE_OF_TY_TYKIND, path.span, TykindKind { suggestion: span });
|
||||
cx.emit_span_lint(USAGE_OF_TY_TYKIND, path.span, TykindKind { suggestion: span });
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,19 +186,19 @@ fn check_ty(&mut self, cx: &LateContext<'_>, ty: &'tcx Ty<'tcx>) {
|
||||
|
||||
match span {
|
||||
Some(span) => {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
USAGE_OF_TY_TYKIND,
|
||||
path.span,
|
||||
TykindKind { suggestion: span },
|
||||
);
|
||||
}
|
||||
None => cx.emit_spanned_lint(USAGE_OF_TY_TYKIND, path.span, TykindDiag),
|
||||
None => cx.emit_span_lint(USAGE_OF_TY_TYKIND, path.span, TykindDiag),
|
||||
}
|
||||
} else if !ty.span.from_expansion()
|
||||
&& path.segments.len() > 1
|
||||
&& let Some(ty) = is_ty_or_ty_ctxt(cx, path)
|
||||
{
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
USAGE_OF_QUALIFIED_TY,
|
||||
path.span,
|
||||
TyQualified { ty, suggestion: path.span },
|
||||
@ -285,7 +285,7 @@ fn check_item(&mut self, cx: &EarlyContext<'_>, item: &ast::Item) {
|
||||
&& call_site.ctxt().outer_expn_data().kind
|
||||
!= ExpnKind::Macro(MacroKind::Bang, sym::declare_lint_pass)
|
||||
{
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
LINT_PASS_IMPL_WITHOUT_MACRO,
|
||||
lint_pass.path.span,
|
||||
LintPassByHand,
|
||||
@ -327,7 +327,7 @@ fn check_item(&mut self, cx: &LateContext<'_>, item: &rustc_hir::Item<'_>) {
|
||||
if is_doc_keyword(keyword) {
|
||||
return;
|
||||
}
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
EXISTING_DOC_KEYWORD,
|
||||
attr.span,
|
||||
NonExistentDocKeyword { keyword },
|
||||
@ -405,7 +405,7 @@ fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
|
||||
}
|
||||
debug!(?found_impl);
|
||||
if !found_parent_with_attr && !found_impl {
|
||||
cx.emit_spanned_lint(DIAGNOSTIC_OUTSIDE_OF_IMPL, span, DiagOutOfImpl);
|
||||
cx.emit_span_lint(DIAGNOSTIC_OUTSIDE_OF_IMPL, span, DiagOutOfImpl);
|
||||
}
|
||||
|
||||
let mut found_diagnostic_message = false;
|
||||
@ -421,7 +421,7 @@ fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
|
||||
}
|
||||
debug!(?found_diagnostic_message);
|
||||
if !found_parent_with_attr && !found_diagnostic_message {
|
||||
cx.emit_spanned_lint(UNTRANSLATABLE_DIAGNOSTIC, span, UntranslatableDiag);
|
||||
cx.emit_span_lint(UNTRANSLATABLE_DIAGNOSTIC, span, UntranslatableDiag);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -490,7 +490,7 @@ fn check_stmt(&mut self, cx: &EarlyContext<'_>, stmt: &ast::Stmt) {
|
||||
}) {
|
||||
return;
|
||||
}
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
UNTRANSLATABLE_DIAGNOSTIC_TRIVIAL,
|
||||
stmt.span,
|
||||
UntranslatableDiagnosticTrivial,
|
||||
@ -528,7 +528,7 @@ fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
|
||||
&& let Some(lit) = item.lit()
|
||||
&& let ast::LitKind::Str(val, _) = lit.kind
|
||||
{
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
BAD_OPT_ACCESS,
|
||||
expr.span,
|
||||
BadOptAccessDiag { msg: val.as_str() },
|
||||
@ -553,7 +553,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &Expr<'_>) {
|
||||
expr.kind
|
||||
{
|
||||
if is_span_ctxt_call(cx, lhs) && is_span_ctxt_call(cx, rhs) {
|
||||
cx.emit_spanned_lint(SPAN_USE_EQ_CTXT, expr.span, SpanUseEqCtxtDiag);
|
||||
cx.emit_span_lint(SPAN_USE_EQ_CTXT, expr.span, SpanUseEqCtxtDiag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
|
||||
let valid_up_to = utf8_error.valid_up_to();
|
||||
let is_unchecked_variant = diag_item.as_str().contains("unchecked");
|
||||
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
if is_unchecked_variant {
|
||||
INVALID_FROM_UTF8_UNCHECKED
|
||||
} else {
|
||||
|
@ -160,14 +160,10 @@ fn check_local(&mut self, cx: &LateContext<'_>, local: &hir::Local<'_>) {
|
||||
pat.span,
|
||||
"this lock is not assigned to a binding and is immediately dropped".to_string(),
|
||||
);
|
||||
cx.emit_spanned_lint(LET_UNDERSCORE_LOCK, span, NonBindingLet::SyncLock { sub });
|
||||
cx.emit_span_lint(LET_UNDERSCORE_LOCK, span, NonBindingLet::SyncLock { sub });
|
||||
// Only emit let_underscore_drop for top-level `_` patterns.
|
||||
} else if can_use_init.is_some() {
|
||||
cx.emit_spanned_lint(
|
||||
LET_UNDERSCORE_DROP,
|
||||
local.span,
|
||||
NonBindingLet::DropType { sub },
|
||||
);
|
||||
cx.emit_span_lint(LET_UNDERSCORE_DROP, local.span, NonBindingLet::DropType { sub });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &Stmt<'_>) {
|
||||
let fn_ty = cx.tcx.fn_sig(id).skip_binder();
|
||||
let ret_ty = fn_ty.output().skip_binder();
|
||||
if is_unit_type(ret_ty) {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
MAP_UNIT_FN,
|
||||
span,
|
||||
MappingToUnit {
|
||||
@ -80,7 +80,7 @@ fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &Stmt<'_>) {
|
||||
let cl_ty = subs.as_closure().sig();
|
||||
let ret_ty = cl_ty.output().skip_binder();
|
||||
if is_unit_type(ret_ty) {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
MAP_UNIT_FN,
|
||||
span,
|
||||
MappingToUnit {
|
||||
|
@ -57,7 +57,7 @@ fn lint_cstring_as_ptr(
|
||||
if cx.tcx.is_diagnostic_item(sym::Result, def.did()) {
|
||||
if let ty::Adt(adt, _) = args.type_at(0).kind() {
|
||||
if cx.tcx.is_diagnostic_item(sym::cstring_type, adt.did()) {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
TEMPORARY_CSTRING_AS_PTR,
|
||||
as_ptr_span,
|
||||
CStringPtr { as_ptr: as_ptr_span, unwrap: unwrap.span },
|
||||
|
@ -49,7 +49,7 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) {
|
||||
.into_iter()
|
||||
.filter_map(|(pred, _)| pred.as_trait_clause());
|
||||
if direct_super_traits_iter.count() > 1 {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
MULTIPLE_SUPERTRAIT_UPCASTABLE,
|
||||
cx.tcx.def_span(def_id),
|
||||
crate::lints::MultipleSupertraitUpcastable { ident: item.ident },
|
||||
|
@ -186,11 +186,11 @@ fn check_crate(&mut self, cx: &EarlyContext<'_>, _: &ast::Crate) {
|
||||
continue;
|
||||
}
|
||||
has_non_ascii_idents = true;
|
||||
cx.emit_spanned_lint(NON_ASCII_IDENTS, sp, IdentifierNonAsciiChar);
|
||||
cx.emit_span_lint(NON_ASCII_IDENTS, sp, IdentifierNonAsciiChar);
|
||||
if check_uncommon_codepoints
|
||||
&& !symbol_str.chars().all(GeneralSecurityProfile::identifier_allowed)
|
||||
{
|
||||
cx.emit_spanned_lint(UNCOMMON_CODEPOINTS, sp, IdentifierUncommonCodepoints);
|
||||
cx.emit_span_lint(UNCOMMON_CODEPOINTS, sp, IdentifierUncommonCodepoints);
|
||||
}
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ fn check_crate(&mut self, cx: &EarlyContext<'_>, _: &ast::Crate) {
|
||||
.entry(skeleton_sym)
|
||||
.and_modify(|(existing_symbol, existing_span, existing_is_ascii)| {
|
||||
if !*existing_is_ascii || !is_ascii {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
CONFUSABLE_IDENTS,
|
||||
sp,
|
||||
ConfusableIdentifierPair {
|
||||
@ -339,7 +339,7 @@ enum ScriptSetUsage {
|
||||
let char_info = format!("'{}' (U+{:04X})", ch, ch as u32);
|
||||
includes += &char_info;
|
||||
}
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
MIXED_SCRIPT_CONFUSABLES,
|
||||
sp,
|
||||
MixedScriptConfusables { set: script_set.to_string(), includes },
|
||||
|
@ -251,7 +251,7 @@ fn check_panic_str<'tcx>(
|
||||
.map(|span| fmt_span.from_inner(InnerSpan::new(span.start, span.end)))
|
||||
.collect(),
|
||||
};
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
NON_FMT_PANICS,
|
||||
arg_spans,
|
||||
NonFmtPanicUnused {
|
||||
@ -268,7 +268,7 @@ fn check_panic_str<'tcx>(
|
||||
.collect()
|
||||
});
|
||||
let count = brace_spans.as_ref().map(|v| v.len()).unwrap_or(/* any number >1 */ 2);
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
NON_FMT_PANICS,
|
||||
brace_spans.unwrap_or_else(|| vec![span]),
|
||||
NonFmtPanicBraces {
|
||||
|
@ -150,7 +150,7 @@ fn check_case(&self, cx: &EarlyContext<'_>, sort: &str, ident: &Ident) {
|
||||
} else {
|
||||
NonCamelCaseTypeSub::Label { span: ident.span }
|
||||
};
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
NON_CAMEL_CASE_TYPES,
|
||||
ident.span,
|
||||
NonCamelCaseType { sort, name, sub },
|
||||
@ -320,7 +320,7 @@ fn is_snake_case(ident: &str) -> bool {
|
||||
} else {
|
||||
NonSnakeCaseDiagSub::Label { span }
|
||||
};
|
||||
cx.emit_spanned_lint(NON_SNAKE_CASE, span, NonSnakeCaseDiag { sort, name, sc, sub });
|
||||
cx.emit_span_lint(NON_SNAKE_CASE, span, NonSnakeCaseDiag { sort, name, sc, sub });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -481,7 +481,7 @@ fn check_upper_case(cx: &LateContext<'_>, sort: &str, ident: &Ident) {
|
||||
} else {
|
||||
NonUpperCaseGlobalSub::Label { span: ident.span }
|
||||
};
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
NON_UPPER_CASE_GLOBALS,
|
||||
ident.span,
|
||||
NonUpperCaseGlobal { sort, name, sub },
|
||||
|
@ -121,7 +121,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
|
||||
let orig_ty = expr_ty.peel_refs();
|
||||
|
||||
if receiver_ty == expr_ty {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
NOOP_METHOD_CALL,
|
||||
span,
|
||||
NoopMethodCallDiag { method: call.ident.name, orig_ty, trait_, label: span },
|
||||
@ -131,12 +131,12 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
|
||||
// If `type_of(x) == T` and `x.borrow()` is used to get `&T`,
|
||||
// then that should be allowed
|
||||
sym::noop_method_borrow => return,
|
||||
sym::noop_method_clone => cx.emit_spanned_lint(
|
||||
sym::noop_method_clone => cx.emit_span_lint(
|
||||
SUSPICIOUS_DOUBLE_REF_OP,
|
||||
span,
|
||||
SuspiciousDoubleRefCloneDiag { ty: expr_ty },
|
||||
),
|
||||
sym::noop_method_deref => cx.emit_spanned_lint(
|
||||
sym::noop_method_deref => cx.emit_span_lint(
|
||||
SUSPICIOUS_DOUBLE_REF_OP,
|
||||
span,
|
||||
SuspiciousDoubleRefDerefDiag { ty: expr_ty },
|
||||
|
@ -145,7 +145,7 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) {
|
||||
}),
|
||||
_ => None,
|
||||
};
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
OPAQUE_HIDDEN_INFERRED_BOUND,
|
||||
pred_span,
|
||||
OpaqueHiddenInferredBoundLint {
|
||||
|
@ -29,7 +29,7 @@ fn check_ty(&mut self, cx: &LateContext<'_>, ty: &'tcx hir::Ty<'tcx>) {
|
||||
}
|
||||
}
|
||||
if let Some(t) = path_for_pass_by_value(cx, inner_ty) {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
PASS_BY_VALUE,
|
||||
ty.span,
|
||||
PassByValueDiag { ty: t, suggestion: ty.span },
|
||||
|
@ -97,7 +97,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
|
||||
)
|
||||
&& let Some(diag) = incorrect_check(cx, arg) =>
|
||||
{
|
||||
cx.emit_spanned_lint(USELESS_PTR_NULL_CHECKS, expr.span, diag)
|
||||
cx.emit_span_lint(USELESS_PTR_NULL_CHECKS, expr.span, diag)
|
||||
}
|
||||
|
||||
// Catching:
|
||||
@ -110,7 +110,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
|
||||
)
|
||||
&& let Some(diag) = incorrect_check(cx, receiver) =>
|
||||
{
|
||||
cx.emit_spanned_lint(USELESS_PTR_NULL_CHECKS, expr.span, diag)
|
||||
cx.emit_span_lint(USELESS_PTR_NULL_CHECKS, expr.span, diag)
|
||||
}
|
||||
|
||||
ExprKind::Binary(op, left, right) if matches!(op.node, BinOpKind::Eq) => {
|
||||
@ -134,7 +134,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
|
||||
&& let LitKind::Int(v, _) = spanned.node
|
||||
&& v == 0 =>
|
||||
{
|
||||
cx.emit_spanned_lint(USELESS_PTR_NULL_CHECKS, expr.span, diag)
|
||||
cx.emit_span_lint(USELESS_PTR_NULL_CHECKS, expr.span, diag)
|
||||
}
|
||||
|
||||
// Catching:
|
||||
@ -145,7 +145,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
|
||||
&& let Some(diag_item) = cx.tcx.get_diagnostic_name(def_id)
|
||||
&& (diag_item == sym::ptr_null || diag_item == sym::ptr_null_mut) =>
|
||||
{
|
||||
cx.emit_spanned_lint(USELESS_PTR_NULL_CHECKS, expr.span, diag)
|
||||
cx.emit_span_lint(USELESS_PTR_NULL_CHECKS, expr.span, diag)
|
||||
}
|
||||
|
||||
_ => {}
|
||||
|
@ -47,7 +47,7 @@ fn maybe_lint_redundant_semis(cx: &EarlyContext<'_>, seq: &mut Option<(Span, boo
|
||||
return;
|
||||
}
|
||||
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
REDUNDANT_SEMICOLONS,
|
||||
span,
|
||||
RedundantSemicolonsDiag { multiple, suggestion: span },
|
||||
|
@ -47,7 +47,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
|
||||
let orig_cast = if init.span != e.span { Some(init.span) } else { None };
|
||||
let ty_has_interior_mutability = ty_has_interior_mutability.then_some(());
|
||||
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
INVALID_REFERENCE_CASTING,
|
||||
expr.span,
|
||||
if pat == PatternKind::Assign {
|
||||
|
@ -101,7 +101,7 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) {
|
||||
continue;
|
||||
}
|
||||
let Some(def_id) = cx.tcx.get_diagnostic_item(sym::needs_drop) else { return };
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
DROP_BOUNDS,
|
||||
span,
|
||||
DropTraitConstraintsDiag { predicate, tcx: cx.tcx, def_id },
|
||||
@ -116,7 +116,7 @@ fn check_ty(&mut self, cx: &LateContext<'_>, ty: &'tcx hir::Ty<'tcx>) {
|
||||
let def_id = bound.trait_ref.trait_def_id();
|
||||
if cx.tcx.lang_items().drop_trait() == def_id {
|
||||
let Some(def_id) = cx.tcx.get_diagnostic_item(sym::needs_drop) else { return };
|
||||
cx.emit_spanned_lint(DYN_DROP, bound.span, DropGlue { tcx: cx.tcx, def_id });
|
||||
cx.emit_span_lint(DYN_DROP, bound.span, DropGlue { tcx: cx.tcx, def_id });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ fn lint_overflowing_range_endpoint<'tcx>(
|
||||
}
|
||||
};
|
||||
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
OVERFLOWING_LITERALS,
|
||||
struct_expr.span,
|
||||
RangeEndpointOutOfRange { ty, sub: sub_sugg },
|
||||
@ -371,7 +371,7 @@ fn report_bin_hex_error(
|
||||
})
|
||||
.flatten();
|
||||
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
OVERFLOWING_LITERALS,
|
||||
expr.span,
|
||||
OverflowingBinHex {
|
||||
@ -473,7 +473,7 @@ fn lint_int_literal<'tcx>(
|
||||
let help = get_type_suggestion(cx.typeck_results().node_type(e.hir_id), v, negative)
|
||||
.map(|suggestion_ty| OverflowingIntHelp { suggestion_ty });
|
||||
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
OVERFLOWING_LITERALS,
|
||||
span,
|
||||
OverflowingInt { ty: t.name_str(), lit, min, max, help },
|
||||
@ -501,7 +501,7 @@ fn lint_uint_literal<'tcx>(
|
||||
match par_e.kind {
|
||||
hir::ExprKind::Cast(..) => {
|
||||
if let ty::Char = cx.typeck_results().expr_ty(par_e).kind() {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
OVERFLOWING_LITERALS,
|
||||
par_e.span,
|
||||
OnlyCastu8ToChar { span: par_e.span, literal: lit_val },
|
||||
@ -528,7 +528,7 @@ fn lint_uint_literal<'tcx>(
|
||||
);
|
||||
return;
|
||||
}
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
OVERFLOWING_LITERALS,
|
||||
e.span,
|
||||
OverflowingUInt {
|
||||
@ -570,7 +570,7 @@ fn lint_literal<'tcx>(
|
||||
_ => bug!(),
|
||||
};
|
||||
if is_infinite == Ok(true) {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
OVERFLOWING_LITERALS,
|
||||
e.span,
|
||||
OverflowingLiteral {
|
||||
@ -654,7 +654,7 @@ fn eq_ne(
|
||||
_ => return,
|
||||
};
|
||||
|
||||
cx.emit_spanned_lint(INVALID_NAN_COMPARISONS, e.span, lint);
|
||||
cx.emit_span_lint(INVALID_NAN_COMPARISONS, e.span, lint);
|
||||
}
|
||||
|
||||
fn lint_wide_pointer<'tcx>(
|
||||
@ -700,7 +700,7 @@ fn lint_wide_pointer<'tcx>(
|
||||
let (Some(l_span), Some(r_span)) =
|
||||
(l.span.find_ancestor_inside(e.span), r.span.find_ancestor_inside(e.span))
|
||||
else {
|
||||
return cx.emit_spanned_lint(
|
||||
return cx.emit_span_lint(
|
||||
AMBIGUOUS_WIDE_POINTER_COMPARISONS,
|
||||
e.span,
|
||||
AmbiguousWidePointerComparisons::Spanless,
|
||||
@ -718,7 +718,7 @@ fn lint_wide_pointer<'tcx>(
|
||||
let deref_left = &*"*".repeat(l_ty_refs);
|
||||
let deref_right = &*"*".repeat(r_ty_refs);
|
||||
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
AMBIGUOUS_WIDE_POINTER_COMPARISONS,
|
||||
e.span,
|
||||
AmbiguousWidePointerComparisons::Spanful {
|
||||
@ -770,7 +770,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx hir::Expr<'tcx>) {
|
||||
hir::ExprKind::Binary(binop, ref l, ref r) => {
|
||||
if is_comparison(binop) {
|
||||
if !check_limits(cx, binop, l, r) {
|
||||
cx.emit_spanned_lint(UNUSED_COMPARISONS, e.span, UnusedComparisons);
|
||||
cx.emit_span_lint(UNUSED_COMPARISONS, e.span, UnusedComparisons);
|
||||
} else {
|
||||
lint_nan(cx, e, binop, l, r);
|
||||
lint_wide_pointer(cx, e, binop.node, l, r);
|
||||
@ -1464,7 +1464,7 @@ fn emit_ffi_unsafe_type_lint(
|
||||
} else {
|
||||
None
|
||||
};
|
||||
self.cx.emit_spanned_lint(
|
||||
self.cx.emit_span_lint(
|
||||
lint,
|
||||
sp,
|
||||
ImproperCTypes { ty, desc, label: sp, help, note, span_note },
|
||||
@ -1792,7 +1792,7 @@ fn check_item(&mut self, cx: &LateContext<'_>, it: &hir::Item<'_>) {
|
||||
// We only warn if the largest variant is at least thrice as large as
|
||||
// the second-largest.
|
||||
if largest > slargest * 3 && slargest > 0 {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
VARIANT_SIZE_DIFFERENCES,
|
||||
enum_definition.variants[largest_index].span,
|
||||
VariantSizeDifferencesDiag { largest },
|
||||
@ -1913,17 +1913,9 @@ fn check_atomic_load_store(cx: &LateContext<'_>, expr: &Expr<'_>) {
|
||||
&& (ordering == invalid_ordering || ordering == sym::AcqRel)
|
||||
{
|
||||
if method == sym::load {
|
||||
cx.emit_spanned_lint(
|
||||
INVALID_ATOMIC_ORDERING,
|
||||
ordering_arg.span,
|
||||
AtomicOrderingLoad,
|
||||
);
|
||||
cx.emit_span_lint(INVALID_ATOMIC_ORDERING, ordering_arg.span, AtomicOrderingLoad);
|
||||
} else {
|
||||
cx.emit_spanned_lint(
|
||||
INVALID_ATOMIC_ORDERING,
|
||||
ordering_arg.span,
|
||||
AtomicOrderingStore,
|
||||
);
|
||||
cx.emit_span_lint(INVALID_ATOMIC_ORDERING, ordering_arg.span, AtomicOrderingStore);
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -1935,7 +1927,7 @@ fn check_memory_fence(cx: &LateContext<'_>, expr: &Expr<'_>) {
|
||||
&& matches!(cx.tcx.get_diagnostic_name(def_id), Some(sym::fence | sym::compiler_fence))
|
||||
&& Self::match_ordering(cx, &args[0]) == Some(sym::Relaxed)
|
||||
{
|
||||
cx.emit_spanned_lint(INVALID_ATOMIC_ORDERING, args[0].span, AtomicOrderingFence);
|
||||
cx.emit_span_lint(INVALID_ATOMIC_ORDERING, args[0].span, AtomicOrderingFence);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1957,7 +1949,7 @@ fn check_atomic_compare_exchange(cx: &LateContext<'_>, expr: &Expr<'_>) {
|
||||
let Some(fail_ordering) = Self::match_ordering(cx, fail_order_arg) else { return };
|
||||
|
||||
if matches!(fail_ordering, sym::Release | sym::AcqRel) {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
INVALID_ATOMIC_ORDERING,
|
||||
fail_order_arg.span,
|
||||
InvalidAtomicOrderingDiag { method, fail_order_arg_span: fail_order_arg.span },
|
||||
|
@ -62,7 +62,7 @@ fn check_local(&mut self, cx: &crate::LateContext<'tcx>, local: &'tcx hir::Local
|
||||
&& !matches!(init.kind, hir::ExprKind::Tup([]))
|
||||
&& !matches!(local.pat.kind, hir::PatKind::Tuple([], ..))
|
||||
{
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
UNIT_BINDINGS,
|
||||
local.span,
|
||||
UnitBindingsDiag { label: local.pat.span },
|
||||
|
@ -182,7 +182,7 @@ fn check_stmt(&mut self, cx: &LateContext<'_>, s: &hir::Stmt<'_>) {
|
||||
let mut op_warned = false;
|
||||
|
||||
if let Some(must_use_op) = must_use_op {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
UNUSED_MUST_USE,
|
||||
expr.span,
|
||||
UnusedOp {
|
||||
@ -202,7 +202,7 @@ fn check_stmt(&mut self, cx: &LateContext<'_>, s: &hir::Stmt<'_>) {
|
||||
}
|
||||
|
||||
if !(type_lint_emitted_or_suppressed || fn_warned || op_warned) {
|
||||
cx.emit_spanned_lint(UNUSED_RESULTS, s.span, UnusedResult { ty });
|
||||
cx.emit_span_lint(UNUSED_RESULTS, s.span, UnusedResult { ty });
|
||||
}
|
||||
|
||||
fn check_fn_must_use(
|
||||
@ -494,21 +494,21 @@ fn emit_must_use_untranslated(
|
||||
);
|
||||
}
|
||||
MustUsePath::Closure(span) => {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
UNUSED_MUST_USE,
|
||||
*span,
|
||||
UnusedClosure { count: plural_len, pre: descr_pre, post: descr_post },
|
||||
);
|
||||
}
|
||||
MustUsePath::Coroutine(span) => {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
UNUSED_MUST_USE,
|
||||
*span,
|
||||
UnusedCoroutine { count: plural_len, pre: descr_pre, post: descr_post },
|
||||
);
|
||||
}
|
||||
MustUsePath::Def(span, def_id, reason) => {
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
UNUSED_MUST_USE,
|
||||
*span,
|
||||
UnusedDef {
|
||||
@ -568,9 +568,9 @@ fn check_stmt(&mut self, cx: &LateContext<'_>, s: &hir::Stmt<'_>) {
|
||||
} else {
|
||||
PathStatementDropSub::Help { span: s.span }
|
||||
};
|
||||
cx.emit_spanned_lint(PATH_STATEMENTS, s.span, PathStatementDrop { sub })
|
||||
cx.emit_span_lint(PATH_STATEMENTS, s.span, PathStatementDrop { sub })
|
||||
} else {
|
||||
cx.emit_spanned_lint(PATH_STATEMENTS, s.span, PathStatementNoEffect);
|
||||
cx.emit_span_lint(PATH_STATEMENTS, s.span, PathStatementNoEffect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -824,7 +824,7 @@ fn emit_unused_delims(
|
||||
end_replace: hi_replace,
|
||||
}
|
||||
});
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
self.lint(),
|
||||
primary_span,
|
||||
UnusedDelim { delim: Self::DELIM_STR, item: msg, suggestion },
|
||||
@ -1507,7 +1507,7 @@ fn check_use_tree(&self, cx: &EarlyContext<'_>, use_tree: &ast::UseTree, item: &
|
||||
ast::UseTreeKind::Nested(_) => return,
|
||||
};
|
||||
|
||||
cx.emit_spanned_lint(
|
||||
cx.emit_span_lint(
|
||||
UNUSED_IMPORT_BRACES,
|
||||
item.span,
|
||||
UnusedImportBracesDiag { node: node_name },
|
||||
@ -1564,10 +1564,10 @@ fn check_expr(&mut self, cx: &LateContext<'_>, e: &hir::Expr<'_>) {
|
||||
if let adjustment::Adjust::Borrow(adjustment::AutoBorrow::Ref(_, m)) = adj.kind {
|
||||
match m {
|
||||
adjustment::AutoBorrowMutability::Not => {
|
||||
cx.emit_spanned_lint(UNUSED_ALLOCATION, e.span, UnusedAllocationDiag);
|
||||
cx.emit_span_lint(UNUSED_ALLOCATION, e.span, UnusedAllocationDiag);
|
||||
}
|
||||
adjustment::AutoBorrowMutability::Mut { .. } => {
|
||||
cx.emit_spanned_lint(UNUSED_ALLOCATION, e.span, UnusedAllocationMutDiag);
|
||||
cx.emit_span_lint(UNUSED_ALLOCATION, e.span, UnusedAllocationMutDiag);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user