File tree Expand file tree Collapse file tree 1 file changed +29
-1
lines changed
crates/ide-completion/src Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -2010,7 +2010,7 @@ fn main() {
20102010 }
20112011
20122012 #[ test]
2013- fn new_like_fns ( ) {
2013+ fn colon_complete_preferred_order_relevances ( ) {
20142014 check_relevance (
20152015 r#"
20162016struct A;
@@ -2022,6 +2022,34 @@ impl A {
20222022 fn aaaabuilder() -> ABuilder { A }
20232023}
20242024
2025+ fn test() {
2026+ let a = A::$0;
2027+ }
2028+ "# ,
2029+ // preference:
2030+ // fn with no param that returns itself
2031+ // builder like fn
2032+ // fn with param that returns itself
2033+ expect ! [ [ r#"
2034+ fn new_2() [type_could_unify]
2035+ fn aaaabuilder() [type_could_unify]
2036+ fn new_1(…) [type_could_unify]
2037+ me foo(…) [type_could_unify]
2038+ "# ] ] ,
2039+ ) ;
2040+
2041+ // Generic
2042+ check_relevance (
2043+ r#"
2044+ struct A<T>{item: T}
2045+ struct ABuilder;
2046+ impl A {
2047+ fn foo(&self) {}
2048+ fn new_1<T>(input: u32, l: T) -> A<T> { A }
2049+ fn new_2<T>() -> Self { A { item: <_>::default()} }
2050+ fn aaaabuilder<T>() -> ABuilder<T> { A }
2051+ }
2052+
20252053fn test() {
20262054 let a = A::$0;
20272055}
You can’t perform that action at this time.
0 commit comments