Add a fn main() {} to a doctest to prevent the test from being wrapped in a fn main() {} body

This commit is contained in:
Oli Scherer 2024-06-11 15:32:38 +00:00
parent 0bc2001879
commit 85f2ecab57
2 changed files with 6 additions and 0 deletions

View File

@ -39,6 +39,8 @@ type Foo<T> = impl std::fmt::Debug;
fn foo<U>() -> Foo<U> { fn foo<U>() -> Foo<U> {
5u32 5u32
} }
fn main() {}
``` ```
This means that no matter the generic parameter to `foo`, This means that no matter the generic parameter to `foo`,
@ -57,4 +59,6 @@ type Foo<T: Debug> = impl Debug;
fn foo<U: Debug>() -> Foo<U> { fn foo<U: Debug>() -> Foo<U> {
Vec::<U>::new() Vec::<U>::new()
} }
fn main() {}
``` ```

View File

@ -46,6 +46,8 @@ declare_lint! {
/// fn test() -> impl Trait<Assoc = Tait> { /// fn test() -> impl Trait<Assoc = Tait> {
/// 42 /// 42
/// } /// }
///
/// fn main() {}
/// ``` /// ```
/// ///
/// {{produces}} /// {{produces}}