]> git.lizzy.rs Git - rust.git/commit - src/tools/rustfmt
Auto merge of #78864 - Mark-Simulacrum:warn-on-forbids, r=pnkfelix
authorbors <bors@rust-lang.org>
Wed, 2 Dec 2020 02:07:45 +0000 (02:07 +0000)
committerbors <bors@rust-lang.org>
Wed, 2 Dec 2020 02:07:45 +0000 (02:07 +0000)
commiteb4860c7e1e4109d94e84adc2794f720120604e3
tree648bc7482399f55dd21180f48a8f76b7f32f1a17
parent18aa5ee209df502e48180b1b607520cfd370990f
parent64efcbe0e9e0e2dc02960031e6df4fe7450782ca
Auto merge of #78864 - Mark-Simulacrum:warn-on-forbids, r=pnkfelix

Use true previous lint level when detecting overriden forbids

Previously, cap-lints was ignored when checking the previous forbid level, which
meant that it was a hard error to do so. This is different from the normal
behavior of lints, which are silenced by cap-lints; if the forbid would not take
effect regardless, there is not much point in complaining about the fact that we
are reducing its level.

It might be considered a bug that even `--cap-lints deny` would suffice to
silence the error on overriding forbid, depending on if one cares about failing
the build or precisely forbid being set. But setting cap-lints to deny is quite
odd and not really done in practice, so we don't try to handle it specially.

This also unifies the code paths for nested and same-level scopes. However, the
special case for CLI lint flags is left in place (introduced by #70918) to fix
the regression noted in #70819. That means that CLI flags do not lint on forbid
being overridden by a non-forbid level. It is unclear whether this is a bug or a
desirable feature, but it is certainly inconsistent. CLI flags are a
sufficiently different "type" of place though that this is deemed out of scope
for this commit.

r? `@pnkfelix` perhaps?

cc #77713 -- not marking as "Fixes" because of the lack of proper unused attribute handling in this PR
compiler/rustc_lint/src/levels.rs