Merge pull request #2 from Infineon/filter_test_main · rust-lang/rust@2d9f036 (original) (raw)

`@@ -506,8 +506,16 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {

`

506

506

` hir::ItemKind::Mod(ref m) => {

`

507

507

`self.enter_mod(item.owner_id.def_id, m, name, renamed, import_id);

`

508

508

`}

`

509

``

`-

hir::ItemKind::Fn(..)

`

510

``

`-

| hir::ItemKind::ExternCrate(..)

`

``

509

`+

hir::ItemKind::Fn(fn_sig, _, _) => {

`

``

510

`+

// Don't show auto created function "main" that is not in the source code (empty span) when documenting tests.

`

``

511

`+

if !(self.cx.cache.document_tests

`

``

512

`+

&& fn_sig.span.is_empty()

`

``

513

`+

&& name.as_str() == "main")

`

``

514

`+

{

`

``

515

`+

self.add_to_current_mod(item, renamed, import_id);

`

``

516

`+

}

`

``

517

`+

}

`

``

518

`+

hir::ItemKind::ExternCrate(..)

`

511

519

` | hir::ItemKind::Enum(..)

`

512

520

` | hir::ItemKind::Struct(..)

`

513

521

` | hir::ItemKind::Union(..)

`