diff --git a/crates/ide-assists/src/handlers/explicit_enum_discriminant.rs b/crates/ide-assists/src/handlers/explicit_enum_discriminant.rs index b5b7da69f7..fafc3448a8 100644 --- a/crates/ide-assists/src/handlers/explicit_enum_discriminant.rs +++ b/crates/ide-assists/src/handlers/explicit_enum_discriminant.rs @@ -100,6 +100,8 @@ enum TheEnum$0 { Bar, Baz = 42, Quux, + FooBar = -5, + FooBaz, } "#, r#" @@ -108,6 +110,8 @@ enum TheEnum { Bar = 1, Baz = 42, Quux = 43, + FooBar = -5, + FooBaz = -4, } "#, ); diff --git a/crates/ide-assists/src/tests/generated.rs b/crates/ide-assists/src/tests/generated.rs index dce7bbf342..48e12a8107 100644 --- a/crates/ide-assists/src/tests/generated.rs +++ b/crates/ide-assists/src/tests/generated.rs @@ -909,6 +909,29 @@ fn qux(bar: Bar, baz: Baz) {} ) } +#[test] +fn doctest_explicit_enum_discriminant() { + check_doc_test( + "explicit_enum_discriminant", + r#####" +enum TheEnum$0 { + Foo, + Bar, + Baz = 42, + Quux, +} +"#####, + r#####" +enum TheEnum { + Foo = 0, + Bar = 1, + Baz = 42, + Quux = 43, +} +"#####, + ) +} + #[test] fn doctest_extract_expressions_from_format_string() { check_doc_test(