diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-16 19:28:47 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-16 19:28:47 +0000 |
commit | 9375207461dc69d622ecc46e924be70c08339d33 (patch) | |
tree | 2f1c13483133277b4bc79adac16559d4e2a58418 /crates/ide_assists | |
parent | 4771a5f1ca810a3f3697aea8da5af6dc8c03bbd1 (diff) | |
parent | d733c9bdad81e23959b1a43421a9fa6ea92eda9f (diff) |
Merge #8060
8060: Move more bounds r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ide_assists')
-rw-r--r-- | crates/ide_assists/src/handlers/move_bounds.rs | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/crates/ide_assists/src/handlers/move_bounds.rs b/crates/ide_assists/src/handlers/move_bounds.rs index 48efa67ed..9ad0c9816 100644 --- a/crates/ide_assists/src/handlers/move_bounds.rs +++ b/crates/ide_assists/src/handlers/move_bounds.rs | |||
@@ -40,9 +40,9 @@ pub(crate) fn move_bounds_to_where_clause(acc: &mut Assists, ctx: &AssistContext | |||
40 | let where_clause: ast::WhereClause = match_ast! { | 40 | let where_clause: ast::WhereClause = match_ast! { |
41 | match parent { | 41 | match parent { |
42 | ast::Fn(it) => it.get_or_create_where_clause(), | 42 | ast::Fn(it) => it.get_or_create_where_clause(), |
43 | // ast::Trait(it) => it.get_or_create_where_clause(), | 43 | ast::Trait(it) => it.get_or_create_where_clause(), |
44 | ast::Impl(it) => it.get_or_create_where_clause(), | 44 | ast::Impl(it) => it.get_or_create_where_clause(), |
45 | // ast::Enum(it) => it.get_or_create_where_clause(), | 45 | ast::Enum(it) => it.get_or_create_where_clause(), |
46 | ast::Struct(it) => it.get_or_create_where_clause(), | 46 | ast::Struct(it) => it.get_or_create_where_clause(), |
47 | _ => return, | 47 | _ => return, |
48 | } | 48 | } |
@@ -82,12 +82,8 @@ mod tests { | |||
82 | fn move_bounds_to_where_clause_fn() { | 82 | fn move_bounds_to_where_clause_fn() { |
83 | check_assist( | 83 | check_assist( |
84 | move_bounds_to_where_clause, | 84 | move_bounds_to_where_clause, |
85 | r#" | 85 | r#"fn foo<T: u32, $0F: FnOnce(T) -> T>() {}"#, |
86 | fn foo<T: u32, $0F: FnOnce(T) -> T>() {} | 86 | r#"fn foo<T, F>() where T: u32, F: FnOnce(T) -> T {}"#, |
87 | "#, | ||
88 | r#" | ||
89 | fn foo<T, F>() where T: u32, F: FnOnce(T) -> T {} | ||
90 | "#, | ||
91 | ); | 87 | ); |
92 | } | 88 | } |
93 | 89 | ||
@@ -95,12 +91,8 @@ mod tests { | |||
95 | fn move_bounds_to_where_clause_impl() { | 91 | fn move_bounds_to_where_clause_impl() { |
96 | check_assist( | 92 | check_assist( |
97 | move_bounds_to_where_clause, | 93 | move_bounds_to_where_clause, |
98 | r#" | 94 | r#"impl<U: u32, $0T> A<U, T> {}"#, |
99 | impl<U: u32, $0T> A<U, T> {} | 95 | r#"impl<U, T> A<U, T> where U: u32 {}"#, |
100 | "#, | ||
101 | r#" | ||
102 | impl<U, T> A<U, T> where U: u32 {} | ||
103 | "#, | ||
104 | ); | 96 | ); |
105 | } | 97 | } |
106 | 98 | ||
@@ -108,12 +100,8 @@ mod tests { | |||
108 | fn move_bounds_to_where_clause_struct() { | 100 | fn move_bounds_to_where_clause_struct() { |
109 | check_assist( | 101 | check_assist( |
110 | move_bounds_to_where_clause, | 102 | move_bounds_to_where_clause, |
111 | r#" | 103 | r#"struct A<$0T: Iterator<Item = u32>> {}"#, |
112 | struct A<$0T: Iterator<Item = u32>> {} | 104 | r#"struct A<T> where T: Iterator<Item = u32> {}"#, |
113 | "#, | ||
114 | r#" | ||
115 | struct A<T> where T: Iterator<Item = u32> {} | ||
116 | "#, | ||
117 | ); | 105 | ); |
118 | } | 106 | } |
119 | 107 | ||
@@ -121,12 +109,8 @@ mod tests { | |||
121 | fn move_bounds_to_where_clause_tuple_struct() { | 109 | fn move_bounds_to_where_clause_tuple_struct() { |
122 | check_assist( | 110 | check_assist( |
123 | move_bounds_to_where_clause, | 111 | move_bounds_to_where_clause, |
124 | r#" | 112 | r#"struct Pair<$0T: u32>(T, T);"#, |
125 | struct Pair<$0T: u32>(T, T); | 113 | r#"struct Pair<T>(T, T) where T: u32;"#, |
126 | "#, | ||
127 | r#" | ||
128 | struct Pair<T>(T, T) where T: u32; | ||
129 | "#, | ||
130 | ); | 114 | ); |
131 | } | 115 | } |
132 | } | 116 | } |