File tree 1 file changed +7
-1
lines changed
compiler/rustc_metadata/src
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -195,10 +195,16 @@ impl CStore {
195
195
}
196
196
197
197
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
+ }
198
204
let level = tcx
199
205
. lint_level_at_node ( lint:: builtin:: UNUSED_CRATE_DEPENDENCIES , rustc_hir:: CRATE_HIR_ID )
200
206
. 0 ;
201
- if level != lint:: Level :: Allow && tcx . sess . opts . json_unused_externs {
207
+ if level != lint:: Level :: Allow {
202
208
let unused_externs =
203
209
self . unused_externs . iter ( ) . map ( |ident| ident. to_ident_string ( ) ) . collect :: < Vec < _ > > ( ) ;
204
210
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