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