@@ -277,20 +277,20 @@ impl DocTestBuilder {
277277 /// lines before the test code begins.
278278 pub ( crate ) fn generate_unique_doctest (
279279 & self ,
280- test_code : & str ,
280+ doctest_code : & str ,
281281 dont_insert_main : bool ,
282282 opts : & GlobalTestOptions ,
283283 crate_name : Option < & str > ,
284284 ) -> ( DocTestWrapResult , usize ) {
285285 if self . invalid_ast {
286286 // If the AST failed to compile, no need to go generate a complete doctest, the error
287287 // will be better this way.
288- debug ! ( "invalid AST:\n {test_code }" ) ;
289- return ( DocTestWrapResult :: SyntaxError ( test_code . to_string ( ) ) , 0 ) ;
288+ debug ! ( "invalid AST:\n {doctest_code }" ) ;
289+ return ( DocTestWrapResult :: SyntaxError ( doctest_code . to_string ( ) ) , 0 ) ;
290290 }
291291 let mut line_offset = 0 ;
292292 let mut crate_level_code = String :: new ( ) ;
293- let code = self . everything_else . trim ( ) . to_string ( ) ;
293+ let processed_code = self . everything_else . trim ( ) . to_string ( ) ;
294294 if opts. attrs . is_empty ( ) {
295295 // If there aren't any attributes supplied by #![doc(test(attr(...)))], then allow some
296296 // lints that are commonly triggered in doctests. The crate-level test attributes are
@@ -337,7 +337,7 @@ impl DocTestBuilder {
337337 // NOTE: this is terribly inaccurate because it doesn't actually
338338 // parse the source, but only has false positives, not false
339339 // negatives.
340- test_code . contains ( crate_name)
340+ doctest_code . contains ( crate_name)
341341 {
342342 // rustdoc implicitly inserts an `extern crate` item for the own crate
343343 // which may be unused, so we need to allow the lint.
@@ -354,7 +354,7 @@ impl DocTestBuilder {
354354 {
355355 None
356356 } else {
357- let returns_result = code . ends_with ( "(())" ) ;
357+ let returns_result = processed_code . ends_with ( "(())" ) ;
358358 // Give each doctest main function a unique name.
359359 // This is for example needed for the tooling around `-C instrument-coverage`.
360360 let inner_fn_name = if let Some ( ref test_id) = self . test_id {
@@ -396,7 +396,7 @@ impl DocTestBuilder {
396396 } )
397397 } ;
398398
399- ( DocTestWrapResult :: Valid { code, wrapper, crate_level_code } , line_offset)
399+ ( DocTestWrapResult :: Valid { code : processed_code , wrapper, crate_level_code } , line_offset)
400400 }
401401}
402402
0 commit comments