@@ -105,7 +105,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
105105 registry : rustc_driver:: diagnostics_registry ( ) ,
106106 } ;
107107
108- let mut test_args = options. test_args . clone ( ) ;
108+ let test_args = options. test_args . clone ( ) ;
109109 let display_warnings = options. display_warnings ;
110110 let nocapture = options. nocapture ;
111111 let externs = options. externs . clone ( ) ;
@@ -166,12 +166,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
166166 Err ( ErrorReported ) => return Err ( ErrorReported ) ,
167167 } ;
168168
169- test_args. insert ( 0 , "rustdoctest" . to_string ( ) ) ;
170- if nocapture {
171- test_args. push ( "--nocapture" . to_string ( ) ) ;
172- }
173-
174- test:: test_main ( & test_args, tests, Some ( test:: Options :: new ( ) . display_output ( display_warnings) ) ) ;
169+ run_tests ( test_args, nocapture, display_warnings, tests) ;
175170
176171 // Collect and warn about unused externs, but only if we've gotten
177172 // reports for each doctest
@@ -214,6 +209,19 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
214209 Ok ( ( ) )
215210}
216211
212+ crate fn run_tests (
213+ mut test_args : Vec < String > ,
214+ nocapture : bool ,
215+ display_warnings : bool ,
216+ tests : Vec < test:: TestDescAndFn > ,
217+ ) {
218+ test_args. insert ( 0 , "rustdoctest" . to_string ( ) ) ;
219+ if nocapture {
220+ test_args. push ( "--nocapture" . to_string ( ) ) ;
221+ }
222+ test:: test_main ( & test_args, tests, Some ( test:: Options :: new ( ) . display_output ( display_warnings) ) ) ;
223+ }
224+
217225// Look for `#![doc(test(no_crate_inject))]`, used by crates in the std facade.
218226fn scrape_test_config ( attrs : & [ ast:: Attribute ] ) -> TestOptions {
219227 use rustc_ast_pretty:: pprust;
0 commit comments