From ecac8e3514b84104dc932cb92524cd3152453218 Mon Sep 17 00:00:00 2001 From: Wyatt Herkamp Date: Sun, 24 Mar 2024 10:37:41 -0400 Subject: [PATCH] Format and codegen for attr --- crates/ide-assists/src/lib.rs | 2 +- crates/ide-assists/src/tests/generated.rs | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/crates/ide-assists/src/lib.rs b/crates/ide-assists/src/lib.rs index 1364120ea23..024448ef1e7 100644 --- a/crates/ide-assists/src/lib.rs +++ b/crates/ide-assists/src/lib.rs @@ -344,7 +344,7 @@ pub(crate) fn all() -> &'static [Handler] { unqualify_method_call::unqualify_method_call, wrap_return_type_in_result::wrap_return_type_in_result, wrap_unwrap_cfg_attr::wrap_unwrap_cfg_attr, - + // These are manually sorted for better priorities. By default, // priority is determined by the size of the target range (smaller // target wins). If the ranges are equal, position in this list is diff --git a/crates/ide-assists/src/tests/generated.rs b/crates/ide-assists/src/tests/generated.rs index a66e199a75b..2bf09347672 100644 --- a/crates/ide-assists/src/tests/generated.rs +++ b/crates/ide-assists/src/tests/generated.rs @@ -3151,3 +3151,22 @@ fn foo() -> Result { Ok(42i32) } "#####, ) } + +#[test] +fn doctest_wrap_unwrap_cfg_attr() { + check_doc_test( + "wrap_unwrap_cfg_attr", + r#####" +#[derive$0(Debug)] +struct S { + field: i32 +} +"#####, + r#####" +#[cfg_attr($0, derive(Debug))] +struct S { + field: i32 +} +"#####, + ) +}