Skip to content

Commit bdab02c

Browse files
committed
Guard decorate on when not to skip instead
1 parent 60de755 commit bdab02c

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

compiler/rustc_middle/src/lint.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,10 @@ pub fn lint_level(
408408
// 2. If the corresponding `rustc_errors::Level` is warning, then that can be affected by
409409
// `-A warnings` or `--cap-lints=xxx` on the command line. In which case, the diagnostic
410410
// will be emitted if `can_emit_warnings` is true.
411-
{
412-
use rustc_errors::Level as ELevel;
413-
if matches!(err_level, ELevel::ForceWarning(_) | ELevel::Error)
414-
|| sess.dcx().can_emit_warnings()
415-
{
416-
decorate(&mut err);
417-
}
411+
let skip = err_level == rustc_errors::Level::Warning && !sess.dcx().can_emit_warnings();
412+
413+
if !skip {
414+
decorate(&mut err);
418415
}
419416

420417
explain_lint_level_source(lint, level, src, &mut err);

0 commit comments

Comments
 (0)