mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 14:13:58 +00:00
generate default implementation for an enum from an enum variant #6860
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
This commit is contained in:
parent
08090d81b1
commit
490475ee19
1 changed files with 21 additions and 21 deletions
|
@ -106,15 +106,15 @@ mod tests {
|
|||
check_assist(
|
||||
generate_default_from_enum_variant,
|
||||
r#"enum Variant {
|
||||
Undefined,
|
||||
Minor<|>,
|
||||
Major,
|
||||
}"#,
|
||||
Undefined,
|
||||
Minor<|>,
|
||||
Major,
|
||||
}"#,
|
||||
r#"enum Variant {
|
||||
Undefined,
|
||||
Minor,
|
||||
Major,
|
||||
}
|
||||
Undefined,
|
||||
Minor,
|
||||
Major,
|
||||
}
|
||||
|
||||
impl Default for Variant {
|
||||
fn default() -> Self {
|
||||
|
@ -129,16 +129,16 @@ impl Default for Variant {
|
|||
mark::check!(test_gen_default_impl_already_exists);
|
||||
check_not_applicable(
|
||||
r#"enum Variant {
|
||||
Undefined,
|
||||
Minor<|>,
|
||||
Major,
|
||||
}
|
||||
Undefined,
|
||||
Minor<|>,
|
||||
Major,
|
||||
}
|
||||
|
||||
impl Default for Variant {
|
||||
fn default() -> Self {
|
||||
Self::Minor
|
||||
}
|
||||
}"#,
|
||||
impl Default for Variant {
|
||||
fn default() -> Self {
|
||||
Self::Minor
|
||||
}
|
||||
}"#,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -147,10 +147,10 @@ impl Default for Variant {
|
|||
mark::check!(test_gen_default_on_non_unit_variant_not_implemented);
|
||||
check_not_applicable(
|
||||
r#"enum Variant {
|
||||
Undefined,
|
||||
Minor(u32)<|>,
|
||||
Major,
|
||||
}"#,
|
||||
Undefined,
|
||||
Minor(u32)<|>,
|
||||
Major,
|
||||
}"#,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue