Remove box syntax from doctest.rs

Doctests are fairly cold code, so even if there
is a regression, which i doubt, it won't matter.
This commit is contained in:
est31 2022-07-11 00:05:19 +02:00
parent 94a09232ff
commit cb5e94bb62

View File

@ -103,7 +103,7 @@ pub(crate) fn run(options: RustdocOptions) -> Result<(), ErrorGuaranteed> {
diagnostic_output: DiagnosticOutput::Default, diagnostic_output: DiagnosticOutput::Default,
lint_caps, lint_caps,
parse_sess_created: None, parse_sess_created: None,
register_lints: Some(box crate::lint::register_lints), register_lints: Some(Box::new(crate::lint::register_lints)),
override_queries: None, override_queries: None,
make_codegen_backend: None, make_codegen_backend: None,
registry: rustc_driver::diagnostics_registry(), registry: rustc_driver::diagnostics_registry(),
@ -556,7 +556,7 @@ pub(crate) fn make_test(
.supports_color(); .supports_color();
let emitter = EmitterWriter::new( let emitter = EmitterWriter::new(
box io::sink(), Box::new(io::sink()),
None, None,
None, None,
fallback_bundle, fallback_bundle,
@ -568,7 +568,7 @@ pub(crate) fn make_test(
); );
// FIXME(misdreavus): pass `-Z treat-err-as-bug` to the doctest parser // FIXME(misdreavus): pass `-Z treat-err-as-bug` to the doctest parser
let handler = Handler::with_emitter(false, None, box emitter); let handler = Handler::with_emitter(false, None, Box::new(emitter));
let sess = ParseSess::with_span_handler(handler, sm); let sess = ParseSess::with_span_handler(handler, sm);
let mut found_main = false; let mut found_main = false;
@ -1005,7 +1005,7 @@ impl Tester for Collector {
if let Err(err) = std::fs::create_dir_all(&path) { if let Err(err) = std::fs::create_dir_all(&path) {
eprintln!("Couldn't create directory for doctest executables: {}", err); eprintln!("Couldn't create directory for doctest executables: {}", err);
panic::resume_unwind(box ()); panic::resume_unwind(Box::new(()));
} }
DirState::Perm(path) DirState::Perm(path)
@ -1034,7 +1034,7 @@ impl Tester for Collector {
no_run, no_run,
test_type: test::TestType::DocTest, test_type: test::TestType::DocTest,
}, },
testfn: test::DynTestFn(box move || { testfn: test::DynTestFn(Box::new(move || {
let report_unused_externs = |uext| { let report_unused_externs = |uext| {
unused_externs.lock().unwrap().push(uext); unused_externs.lock().unwrap().push(uext);
}; };
@ -1105,9 +1105,9 @@ impl Tester for Collector {
} }
} }
panic::resume_unwind(box ()); panic::resume_unwind(Box::new(()));
} }
}), })),
}); });
} }