diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-16 18:54:47 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-16 18:54:47 +0100 |
commit | 5274eb12dd87f0d790f2871d63f8e3c6f69d3ae9 (patch) | |
tree | f62948559c4dc1b9901c03f535d43d360a70d3ad /crates/ide_completion/src/completions | |
parent | 47b40b6603ad8b9f76a46fda41d6c65d3acd9f9b (diff) | |
parent | 739edfd5cf6d1f5ac1ec6dbc28fc7943b3936e24 (diff) |
Merge #8539
8539: fix: Do not propose inherent traits in flyimports and import assists r=flodiebold a=SomeoneToIgnore
Closes https://github.com/rust-analyzer/rust-analyzer/issues/8520
I've went with a separate method approach, since the [highlighted code](https://github.com/rust-analyzer/rust-analyzer/issues/8520#issuecomment-819856337) has not`Type` and uses `Ty` to get his data, but the code I had to change has no access to `Ty` and has `Type` only.
Co-authored-by: Kirill Bulatov <[email protected]>
Diffstat (limited to 'crates/ide_completion/src/completions')
-rw-r--r-- | crates/ide_completion/src/completions/flyimport.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/crates/ide_completion/src/completions/flyimport.rs b/crates/ide_completion/src/completions/flyimport.rs index 5e61ecb4d..8e211ae1e 100644 --- a/crates/ide_completion/src/completions/flyimport.rs +++ b/crates/ide_completion/src/completions/flyimport.rs | |||
@@ -1127,4 +1127,27 @@ impl Bar for Foo { | |||
1127 | expect![[r#""#]], | 1127 | expect![[r#""#]], |
1128 | ); | 1128 | ); |
1129 | } | 1129 | } |
1130 | |||
1131 | #[test] | ||
1132 | fn no_inherent_candidates_proposed() { | ||
1133 | check( | ||
1134 | r#" | ||
1135 | mod baz { | ||
1136 | pub trait DefDatabase { | ||
1137 | fn method1(&self); | ||
1138 | } | ||
1139 | pub trait HirDatabase: DefDatabase { | ||
1140 | fn method2(&self); | ||
1141 | } | ||
1142 | } | ||
1143 | |||
1144 | mod bar { | ||
1145 | fn test(db: &dyn crate::baz::HirDatabase) { | ||
1146 | db.metho$0 | ||
1147 | } | ||
1148 | } | ||
1149 | "#, | ||
1150 | expect![[r#""#]], | ||
1151 | ); | ||
1152 | } | ||
1130 | } | 1153 | } |