aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/handlers/change_visibility.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src/handlers/change_visibility.rs')
-rw-r--r--crates/ra_assists/src/handlers/change_visibility.rs30
1 files changed, 13 insertions, 17 deletions
diff --git a/crates/ra_assists/src/handlers/change_visibility.rs b/crates/ra_assists/src/handlers/change_visibility.rs
index fbe459c9c..c21d75be0 100644
--- a/crates/ra_assists/src/handlers/change_visibility.rs
+++ b/crates/ra_assists/src/handlers/change_visibility.rs
@@ -118,17 +118,13 @@ mod tests {
118 118
119 #[test] 119 #[test]
120 fn change_visibility_adds_pub_crate_to_items() { 120 fn change_visibility_adds_pub_crate_to_items() {
121 check_assist(change_visibility, "<|>fn foo() {}", "<|>pub(crate) fn foo() {}"); 121 check_assist(change_visibility, "<|>fn foo() {}", "pub(crate) fn foo() {}");
122 check_assist(change_visibility, "f<|>n foo() {}", "pub(crate) f<|>n foo() {}"); 122 check_assist(change_visibility, "f<|>n foo() {}", "pub(crate) fn foo() {}");
123 check_assist(change_visibility, "<|>struct Foo {}", "<|>pub(crate) struct Foo {}"); 123 check_assist(change_visibility, "<|>struct Foo {}", "pub(crate) struct Foo {}");
124 check_assist(change_visibility, "<|>mod foo {}", "<|>pub(crate) mod foo {}"); 124 check_assist(change_visibility, "<|>mod foo {}", "pub(crate) mod foo {}");
125 check_assist(change_visibility, "<|>trait Foo {}", "<|>pub(crate) trait Foo {}"); 125 check_assist(change_visibility, "<|>trait Foo {}", "pub(crate) trait Foo {}");
126 check_assist(change_visibility, "m<|>od {}", "pub(crate) m<|>od {}"); 126 check_assist(change_visibility, "m<|>od {}", "pub(crate) mod {}");
127 check_assist( 127 check_assist(change_visibility, "unsafe f<|>n foo() {}", "pub(crate) unsafe fn foo() {}");
128 change_visibility,
129 "unsafe f<|>n foo() {}",
130 "pub(crate) unsafe f<|>n foo() {}",
131 );
132 } 128 }
133 129
134 #[test] 130 #[test]
@@ -136,9 +132,9 @@ mod tests {
136 check_assist( 132 check_assist(
137 change_visibility, 133 change_visibility,
138 r"struct S { <|>field: u32 }", 134 r"struct S { <|>field: u32 }",
139 r"struct S { <|>pub(crate) field: u32 }", 135 r"struct S { pub(crate) field: u32 }",
140 ); 136 );
141 check_assist(change_visibility, r"struct S ( <|>u32 )", r"struct S ( <|>pub(crate) u32 )"); 137 check_assist(change_visibility, r"struct S ( <|>u32 )", r"struct S ( pub(crate) u32 )");
142 } 138 }
143 139
144 #[test] 140 #[test]
@@ -152,17 +148,17 @@ mod tests {
152 148
153 #[test] 149 #[test]
154 fn change_visibility_pub_to_pub_crate() { 150 fn change_visibility_pub_to_pub_crate() {
155 check_assist(change_visibility, "<|>pub fn foo() {}", "<|>pub(crate) fn foo() {}") 151 check_assist(change_visibility, "<|>pub fn foo() {}", "pub(crate) fn foo() {}")
156 } 152 }
157 153
158 #[test] 154 #[test]
159 fn change_visibility_pub_crate_to_pub() { 155 fn change_visibility_pub_crate_to_pub() {
160 check_assist(change_visibility, "<|>pub(crate) fn foo() {}", "<|>pub fn foo() {}") 156 check_assist(change_visibility, "<|>pub(crate) fn foo() {}", "pub fn foo() {}")
161 } 157 }
162 158
163 #[test] 159 #[test]
164 fn change_visibility_const() { 160 fn change_visibility_const() {
165 check_assist(change_visibility, "<|>const FOO = 3u8;", "<|>pub(crate) const FOO = 3u8;"); 161 check_assist(change_visibility, "<|>const FOO = 3u8;", "pub(crate) const FOO = 3u8;");
166 } 162 }
167 163
168 #[test] 164 #[test]
@@ -183,7 +179,7 @@ mod tests {
183 // comments 179 // comments
184 180
185 #[derive(Debug)] 181 #[derive(Debug)]
186 <|>pub(crate) struct Foo; 182 pub(crate) struct Foo;
187 ", 183 ",
188 ) 184 )
189 } 185 }