Skip to content

Commit

Permalink
Guard decorate on when not to skip instead
Browse files Browse the repository at this point in the history
  • Loading branch information
jieyouxu committed Mar 17, 2024
1 parent 60de755 commit bdab02c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions compiler/rustc_middle/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,13 +408,10 @@ pub fn lint_level(
// 2. If the corresponding `rustc_errors::Level` is warning, then that can be affected by
// `-A warnings` or `--cap-lints=xxx` on the command line. In which case, the diagnostic
// will be emitted if `can_emit_warnings` is true.
{
use rustc_errors::Level as ELevel;
if matches!(err_level, ELevel::ForceWarning(_) | ELevel::Error)
|| sess.dcx().can_emit_warnings()
{
decorate(&mut err);
}
let skip = err_level == rustc_errors::Level::Warning && !sess.dcx().can_emit_warnings();

if !skip {
decorate(&mut err);
}

explain_lint_level_source(lint, level, src, &mut err);
Expand Down

0 comments on commit bdab02c

Please sign in to comment.