@@ -277,20 +277,20 @@ impl DocTestBuilder {
277
277
/// lines before the test code begins.
278
278
pub ( crate ) fn generate_unique_doctest (
279
279
& self ,
280
- test_code : & str ,
280
+ doctest_code : & str ,
281
281
dont_insert_main : bool ,
282
282
opts : & GlobalTestOptions ,
283
283
crate_name : Option < & str > ,
284
284
) -> ( DocTestWrapResult , usize ) {
285
285
if self . invalid_ast {
286
286
// If the AST failed to compile, no need to go generate a complete doctest, the error
287
287
// 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 ) ;
290
290
}
291
291
let mut line_offset = 0 ;
292
292
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 ( ) ;
294
294
if opts. attrs . is_empty ( ) {
295
295
// If there aren't any attributes supplied by #![doc(test(attr(...)))], then allow some
296
296
// lints that are commonly triggered in doctests. The crate-level test attributes are
@@ -337,7 +337,7 @@ impl DocTestBuilder {
337
337
// NOTE: this is terribly inaccurate because it doesn't actually
338
338
// parse the source, but only has false positives, not false
339
339
// negatives.
340
- test_code . contains ( crate_name)
340
+ doctest_code . contains ( crate_name)
341
341
{
342
342
// rustdoc implicitly inserts an `extern crate` item for the own crate
343
343
// which may be unused, so we need to allow the lint.
@@ -354,7 +354,7 @@ impl DocTestBuilder {
354
354
{
355
355
None
356
356
} else {
357
- let returns_result = code . ends_with ( "(())" ) ;
357
+ let returns_result = processed_code . ends_with ( "(())" ) ;
358
358
// Give each doctest main function a unique name.
359
359
// This is for example needed for the tooling around `-C instrument-coverage`.
360
360
let inner_fn_name = if let Some ( ref test_id) = self . test_id {
@@ -396,7 +396,7 @@ impl DocTestBuilder {
396
396
} )
397
397
} ;
398
398
399
- ( DocTestWrapResult :: Valid { code, wrapper, crate_level_code } , line_offset)
399
+ ( DocTestWrapResult :: Valid { code : processed_code , wrapper, crate_level_code } , line_offset)
400
400
}
401
401
}
402
402
0 commit comments