aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-12-15 08:46:02 +0000
committerBenjamin Coenen <[email protected]>2020-12-15 08:46:02 +0000
commit490475ee198f31b1e294bf91518430a93811074d (patch)
tree0491b0030b259665fb46086436c34422eda4fc49 /crates
parent08090d81b130d349524ec3c5523d62e15dbbf27a (diff)
generate default implementation for an enum from an enum variant #6860
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/assists/src/handlers/generate_default_from_enum_variant.rs44
1 files changed, 22 insertions, 22 deletions
diff --git a/crates/assists/src/handlers/generate_default_from_enum_variant.rs b/crates/assists/src/handlers/generate_default_from_enum_variant.rs
index 6521cb543..5f6885710 100644
--- a/crates/assists/src/handlers/generate_default_from_enum_variant.rs
+++ b/crates/assists/src/handlers/generate_default_from_enum_variant.rs
@@ -106,15 +106,15 @@ mod tests {
106 check_assist( 106 check_assist(
107 generate_default_from_enum_variant, 107 generate_default_from_enum_variant,
108 r#"enum Variant { 108 r#"enum Variant {
109 Undefined, 109 Undefined,
110 Minor<|>, 110 Minor<|>,
111 Major, 111 Major,
112 }"#, 112}"#,
113 r#"enum Variant { 113 r#"enum Variant {
114 Undefined, 114 Undefined,
115 Minor, 115 Minor,
116 Major, 116 Major,
117 } 117}
118 118
119impl Default for Variant { 119impl Default for Variant {
120 fn default() -> Self { 120 fn default() -> Self {
@@ -129,16 +129,16 @@ impl Default for Variant {
129 mark::check!(test_gen_default_impl_already_exists); 129 mark::check!(test_gen_default_impl_already_exists);
130 check_not_applicable( 130 check_not_applicable(
131 r#"enum Variant { 131 r#"enum Variant {
132 Undefined, 132 Undefined,
133 Minor<|>, 133 Minor<|>,
134 Major, 134 Major,
135 } 135}
136 136
137 impl Default for Variant { 137impl Default for Variant {
138 fn default() -> Self { 138 fn default() -> Self {
139 Self::Minor 139 Self::Minor
140 } 140 }
141 }"#, 141}"#,
142 ); 142 );
143 } 143 }
144 144
@@ -147,10 +147,10 @@ impl Default for Variant {
147 mark::check!(test_gen_default_on_non_unit_variant_not_implemented); 147 mark::check!(test_gen_default_on_non_unit_variant_not_implemented);
148 check_not_applicable( 148 check_not_applicable(
149 r#"enum Variant { 149 r#"enum Variant {
150 Undefined, 150 Undefined,
151 Minor(u32)<|>, 151 Minor(u32)<|>,
152 Major, 152 Major,
153 }"#, 153}"#,
154 ); 154 );
155 } 155 }
156 156