File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
compiler/rustc_metadata/src Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -195,10 +195,16 @@ impl CStore {
195195 }
196196
197197 pub fn report_unused_deps ( & self , tcx : TyCtxt < ' _ > ) {
198+ // We put the check for the option before the lint_level_at_node call
199+ // because the call mutates internal state and introducing it
200+ // leads to some ui tests failing.
201+ if !tcx. sess . opts . json_unused_externs {
202+ return ;
203+ }
198204 let level = tcx
199205 . lint_level_at_node ( lint:: builtin:: UNUSED_CRATE_DEPENDENCIES , rustc_hir:: CRATE_HIR_ID )
200206 . 0 ;
201- if level != lint:: Level :: Allow && tcx . sess . opts . json_unused_externs {
207+ if level != lint:: Level :: Allow {
202208 let unused_externs =
203209 self . unused_externs . iter ( ) . map ( |ident| ident. to_ident_string ( ) ) . collect :: < Vec < _ > > ( ) ;
204210 let unused_externs = unused_externs. iter ( ) . map ( String :: as_str) . collect :: < Vec < & str > > ( ) ;
You can’t perform that action at this time.
0 commit comments