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() {
2010
2010
}
2011
2011
2012
2012
#[ test]
2013
- fn new_like_fns ( ) {
2013
+ fn colon_complete_preferred_order_relevances ( ) {
2014
2014
check_relevance (
2015
2015
r#"
2016
2016
struct A;
@@ -2022,6 +2022,34 @@ impl A {
2022
2022
fn aaaabuilder() -> ABuilder { A }
2023
2023
}
2024
2024
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
+
2025
2053
fn test() {
2026
2054
let a = A::$0;
2027
2055
}
You can’t perform that action at this time.
0 commit comments