Add --json unused-externs-silent with original behaviour

Since Cargo wants to do its own fatal error handling for unused
dependencies, add the option `--json unused-externs-silent` which
has the original behaviour of not indicating non-zero exit status for
`deny`/`forbid`-level unused dependencies.
This commit is contained in:
Jeremy Fitzhardinge 2022-04-16 17:11:33 -07:00 committed by Jeremy Fitzhardinge
parent 0529a13b5d
commit c6bafa7322
8 changed files with 65 additions and 15 deletions

View file

@ -969,10 +969,15 @@ impl Handler {
self.inner.borrow_mut().emitter.emit_future_breakage_report(diags)
}
pub fn emit_unused_externs(&self, lint_level: rustc_lint_defs::Level, unused_externs: &[&str]) {
pub fn emit_unused_externs(
&self,
lint_level: rustc_lint_defs::Level,
loud: bool,
unused_externs: &[&str],
) {
let mut inner = self.inner.borrow_mut();
if lint_level.is_error() {
if loud && lint_level.is_error() {
inner.bump_err_count();
}