Rollup merge of #94537 - est31:master, r=notriddle
Use ? operator in one instance instead of manual match As suggested [here](https://github.com/rust-lang/rust/pull/94139#discussion_r818102403). r? `@notriddle`
This commit is contained in:
commit
98c9ee8917
@ -111,58 +111,55 @@
|
||||
let externs = options.externs.clone();
|
||||
let json_unused_externs = options.json_unused_externs;
|
||||
|
||||
let res = interface::run_compiler(config, |compiler| {
|
||||
compiler.enter(|queries| {
|
||||
let mut global_ctxt = queries.global_ctxt()?.take();
|
||||
let (tests, unused_extern_reports, compiling_test_count) =
|
||||
interface::run_compiler(config, |compiler| {
|
||||
compiler.enter(|queries| {
|
||||
let mut global_ctxt = queries.global_ctxt()?.take();
|
||||
|
||||
let collector = global_ctxt.enter(|tcx| {
|
||||
let crate_attrs = tcx.hir().attrs(CRATE_HIR_ID);
|
||||
let collector = global_ctxt.enter(|tcx| {
|
||||
let crate_attrs = tcx.hir().attrs(CRATE_HIR_ID);
|
||||
|
||||
let opts = scrape_test_config(crate_attrs);
|
||||
let enable_per_target_ignores = options.enable_per_target_ignores;
|
||||
let mut collector = Collector::new(
|
||||
tcx.crate_name(LOCAL_CRATE),
|
||||
options,
|
||||
false,
|
||||
opts,
|
||||
Some(compiler.session().parse_sess.clone_source_map()),
|
||||
None,
|
||||
enable_per_target_ignores,
|
||||
);
|
||||
let opts = scrape_test_config(crate_attrs);
|
||||
let enable_per_target_ignores = options.enable_per_target_ignores;
|
||||
let mut collector = Collector::new(
|
||||
tcx.crate_name(LOCAL_CRATE),
|
||||
options,
|
||||
false,
|
||||
opts,
|
||||
Some(compiler.session().parse_sess.clone_source_map()),
|
||||
None,
|
||||
enable_per_target_ignores,
|
||||
);
|
||||
|
||||
let mut hir_collector = HirCollector {
|
||||
sess: compiler.session(),
|
||||
collector: &mut collector,
|
||||
map: tcx.hir(),
|
||||
codes: ErrorCodes::from(
|
||||
compiler.session().opts.unstable_features.is_nightly_build(),
|
||||
),
|
||||
tcx,
|
||||
};
|
||||
hir_collector.visit_testable(
|
||||
"".to_string(),
|
||||
CRATE_HIR_ID,
|
||||
tcx.hir().span(CRATE_HIR_ID),
|
||||
|this| tcx.hir().walk_toplevel_module(this),
|
||||
);
|
||||
let mut hir_collector = HirCollector {
|
||||
sess: compiler.session(),
|
||||
collector: &mut collector,
|
||||
map: tcx.hir(),
|
||||
codes: ErrorCodes::from(
|
||||
compiler.session().opts.unstable_features.is_nightly_build(),
|
||||
),
|
||||
tcx,
|
||||
};
|
||||
hir_collector.visit_testable(
|
||||
"".to_string(),
|
||||
CRATE_HIR_ID,
|
||||
tcx.hir().span(CRATE_HIR_ID),
|
||||
|this| tcx.hir().walk_toplevel_module(this),
|
||||
);
|
||||
|
||||
collector
|
||||
});
|
||||
if compiler.session().diagnostic().has_errors_or_lint_errors() {
|
||||
FatalError.raise();
|
||||
}
|
||||
collector
|
||||
});
|
||||
if compiler.session().diagnostic().has_errors_or_lint_errors() {
|
||||
FatalError.raise();
|
||||
}
|
||||
|
||||
let unused_extern_reports = collector.unused_extern_reports.clone();
|
||||
let compiling_test_count = collector.compiling_test_count.load(Ordering::SeqCst);
|
||||
let ret: Result<_, ErrorGuaranteed> =
|
||||
Ok((collector.tests, unused_extern_reports, compiling_test_count));
|
||||
ret
|
||||
})
|
||||
});
|
||||
let (tests, unused_extern_reports, compiling_test_count) = match res {
|
||||
Ok(res) => res,
|
||||
Err(ErrorGuaranteed) => return Err(ErrorGuaranteed),
|
||||
};
|
||||
let unused_extern_reports = collector.unused_extern_reports.clone();
|
||||
let compiling_test_count = collector.compiling_test_count.load(Ordering::SeqCst);
|
||||
let ret: Result<_, ErrorGuaranteed> =
|
||||
Ok((collector.tests, unused_extern_reports, compiling_test_count));
|
||||
ret
|
||||
})
|
||||
})?;
|
||||
|
||||
run_tests(test_args, nocapture, tests);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user