Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-assists/src/handlers/add_missing_impl_members.rs')
-rw-r--r--crates/ide-assists/src/handlers/add_missing_impl_members.rs49
1 files changed, 49 insertions, 0 deletions
diff --git a/crates/ide-assists/src/handlers/add_missing_impl_members.rs b/crates/ide-assists/src/handlers/add_missing_impl_members.rs
index 11201afb8a..7e03eb3030 100644
--- a/crates/ide-assists/src/handlers/add_missing_impl_members.rs
+++ b/crates/ide-assists/src/handlers/add_missing_impl_members.rs
@@ -2421,4 +2421,53 @@ impl other_file_2::Trait for MyStruct {
}"#,
);
}
+
+ #[test]
+ fn test_qualify_ident_pat_in_default_members() {
+ check_assist(
+ add_missing_default_members,
+ r#"
+//- /lib.rs crate:b new_source_root:library
+pub enum State {
+ Active,
+ Inactive,
+}
+
+use State::*;
+
+pub trait Checker {
+ fn check(&self) -> State;
+
+ fn is_active(&self) -> bool {
+ match self.check() {
+ Active => true,
+ Inactive => false,
+ }
+ }
+}
+//- /main.rs crate:a deps:b
+struct MyChecker;
+
+impl b::Checker for MyChecker {
+ fn check(&self) -> b::State {
+ todo!();
+ }$0
+}"#,
+ r#"
+struct MyChecker;
+
+impl b::Checker for MyChecker {
+ fn check(&self) -> b::State {
+ todo!();
+ }
+
+ $0fn is_active(&self) -> bool {
+ match self.check() {
+ b::State::Active => true,
+ b::State::Inactive => false,
+ }
+ }
+}"#,
+ );
+ }
}