Rollup merge of #87120 - jyn514:rustdoc-cleanup, r=CraftSpider

rustdoc: Remove unnecessary `extern crate` aliases
This commit is contained in:
Guillaume Gomez 2021-07-14 19:53:38 +02:00 committed by GitHub
commit e932ba31e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 16 deletions

View File

@ -167,11 +167,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
test_args.insert(0, "rustdoctest".to_string()); test_args.insert(0, "rustdoctest".to_string());
testing::test_main( test::test_main(&test_args, tests, Some(test::Options::new().display_output(display_warnings)));
&test_args,
tests,
Some(testing::Options::new().display_output(display_warnings)),
);
// Collect and warn about unused externs, but only if we've gotten // Collect and warn about unused externs, but only if we've gotten
// reports for each doctest // reports for each doctest
@ -769,7 +765,7 @@ crate trait Tester {
} }
crate struct Collector { crate struct Collector {
crate tests: Vec<testing::TestDescAndFn>, crate tests: Vec<test::TestDescAndFn>,
// The name of the test displayed to the user, separated by `::`. // The name of the test displayed to the user, separated by `::`.
// //
@ -930,22 +926,22 @@ impl Tester for Collector {
}; };
debug!("creating test {}: {}", name, test); debug!("creating test {}: {}", name, test);
self.tests.push(testing::TestDescAndFn { self.tests.push(test::TestDescAndFn {
desc: testing::TestDesc { desc: test::TestDesc {
name: testing::DynTestName(name), name: test::DynTestName(name),
ignore: match config.ignore { ignore: match config.ignore {
Ignore::All => true, Ignore::All => true,
Ignore::None => false, Ignore::None => false,
Ignore::Some(ref ignores) => ignores.iter().any(|s| target_str.contains(s)), Ignore::Some(ref ignores) => ignores.iter().any(|s| target_str.contains(s)),
}, },
// compiler failures are test failures // compiler failures are test failures
should_panic: testing::ShouldPanic::No, should_panic: test::ShouldPanic::No,
allow_fail: config.allow_fail, allow_fail: config.allow_fail,
compile_fail: config.compile_fail, compile_fail: config.compile_fail,
no_run, no_run,
test_type: testing::TestType::DocTest, test_type: test::TestType::DocTest,
}, },
testfn: testing::DynTestFn(box move || { testfn: test::DynTestFn(box move || {
let report_unused_externs = |uext| { let report_unused_externs = |uext| {
unused_externs.lock().unwrap().push(uext); unused_externs.lock().unwrap().push(uext);
}; };

View File

@ -53,11 +53,11 @@ extern crate rustc_parse;
extern crate rustc_passes; extern crate rustc_passes;
extern crate rustc_resolve; extern crate rustc_resolve;
extern crate rustc_session; extern crate rustc_session;
extern crate rustc_span as rustc_span; extern crate rustc_span;
extern crate rustc_target; extern crate rustc_target;
extern crate rustc_trait_selection; extern crate rustc_trait_selection;
extern crate rustc_typeck; extern crate rustc_typeck;
extern crate test as testing; extern crate test;
#[cfg(feature = "jemalloc")] #[cfg(feature = "jemalloc")]
extern crate tikv_jemalloc_sys; extern crate tikv_jemalloc_sys;

View File

@ -136,10 +136,10 @@ crate fn test(mut options: Options) -> Result<(), String> {
find_testable_code(&input_str, &mut collector, codes, options.enable_per_target_ignores, None); find_testable_code(&input_str, &mut collector, codes, options.enable_per_target_ignores, None);
options.test_args.insert(0, "rustdoctest".to_string()); options.test_args.insert(0, "rustdoctest".to_string());
testing::test_main( test::test_main(
&options.test_args, &options.test_args,
collector.tests, collector.tests,
Some(testing::Options::new().display_output(options.display_warnings)), Some(test::Options::new().display_output(options.display_warnings)),
); );
Ok(()) Ok(())
} }