summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_middle/src/lint.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_middle/src/lint.rs')
-rw-r--r--compiler/rustc_middle/src/lint.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs
index 14343ac11..81c1ae4f6 100644
--- a/compiler/rustc_middle/src/lint.rs
+++ b/compiler/rustc_middle/src/lint.rs
@@ -251,7 +251,7 @@ pub fn explain_lint_level_source(
}
LintLevelSource::Node { name: lint_attr_name, span, reason, .. } => {
if let Some(rationale) = reason {
- err.note(rationale.as_str());
+ err.note(rationale.to_string());
}
err.span_note_once(span, "the lint level is defined here");
if lint_attr_name.as_str() != name {
@@ -388,10 +388,11 @@ pub fn struct_lint_level(
// it'll become a hard error, so we have to emit *something*. Also,
// if this lint occurs in the expansion of a macro from an external crate,
// allow individual lints to opt-out from being reported.
- let not_future_incompatible =
- future_incompatible.map(|f| f.reason.edition().is_some()).unwrap_or(true);
- if not_future_incompatible && !lint.report_in_external_macro {
+ let incompatible = future_incompatible.is_some_and(|f| f.reason.edition().is_none());
+
+ if !incompatible && !lint.report_in_external_macro {
err.cancel();
+
// Don't continue further, since we don't want to have
// `diag_span_note_once` called for a diagnostic that isn't emitted.
return;