aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_diagnostics/src/handlers/incorrect_case.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_diagnostics/src/handlers/incorrect_case.rs')
-rw-r--r--crates/ide_diagnostics/src/handlers/incorrect_case.rs42
1 files changed, 21 insertions, 21 deletions
diff --git a/crates/ide_diagnostics/src/handlers/incorrect_case.rs b/crates/ide_diagnostics/src/handlers/incorrect_case.rs
index 3a33029cf..72f251961 100644
--- a/crates/ide_diagnostics/src/handlers/incorrect_case.rs
+++ b/crates/ide_diagnostics/src/handlers/incorrect_case.rs
@@ -149,7 +149,7 @@ impl TestStruct {
149 check_diagnostics( 149 check_diagnostics(
150 r#" 150 r#"
151fn FOO() {} 151fn FOO() {}
152// ^^^ Function `FOO` should have snake_case name, e.g. `foo` 152// ^^^ 💡 weak: Function `FOO` should have snake_case name, e.g. `foo`
153"#, 153"#,
154 ); 154 );
155 check_fix(r#"fn FOO$0() {}"#, r#"fn foo() {}"#); 155 check_fix(r#"fn FOO$0() {}"#, r#"fn foo() {}"#);
@@ -160,7 +160,7 @@ fn FOO() {}
160 check_diagnostics( 160 check_diagnostics(
161 r#" 161 r#"
162fn NonSnakeCaseName() {} 162fn NonSnakeCaseName() {}
163// ^^^^^^^^^^^^^^^^ Function `NonSnakeCaseName` should have snake_case name, e.g. `non_snake_case_name` 163// ^^^^^^^^^^^^^^^^ 💡 weak: Function `NonSnakeCaseName` should have snake_case name, e.g. `non_snake_case_name`
164"#, 164"#,
165 ); 165 );
166 } 166 }
@@ -170,10 +170,10 @@ fn NonSnakeCaseName() {}
170 check_diagnostics( 170 check_diagnostics(
171 r#" 171 r#"
172fn foo(SomeParam: u8) {} 172fn foo(SomeParam: u8) {}
173 // ^^^^^^^^^ Parameter `SomeParam` should have snake_case name, e.g. `some_param` 173 // ^^^^^^^^^ 💡 weak: Parameter `SomeParam` should have snake_case name, e.g. `some_param`
174 174
175fn foo2(ok_param: &str, CAPS_PARAM: u8) {} 175fn foo2(ok_param: &str, CAPS_PARAM: u8) {}
176 // ^^^^^^^^^^ Parameter `CAPS_PARAM` should have snake_case name, e.g. `caps_param` 176 // ^^^^^^^^^^ 💡 weak: Parameter `CAPS_PARAM` should have snake_case name, e.g. `caps_param`
177"#, 177"#,
178 ); 178 );
179 } 179 }
@@ -184,9 +184,9 @@ fn foo2(ok_param: &str, CAPS_PARAM: u8) {}
184 r#" 184 r#"
185fn foo() { 185fn foo() {
186 let SOME_VALUE = 10; 186 let SOME_VALUE = 10;
187 // ^^^^^^^^^^ Variable `SOME_VALUE` should have snake_case name, e.g. `some_value` 187 // ^^^^^^^^^^ 💡 weak: Variable `SOME_VALUE` should have snake_case name, e.g. `some_value`
188 let AnotherValue = 20; 188 let AnotherValue = 20;
189 // ^^^^^^^^^^^^ Variable `AnotherValue` should have snake_case name, e.g. `another_value` 189 // ^^^^^^^^^^^^ 💡 weak: Variable `AnotherValue` should have snake_case name, e.g. `another_value`
190} 190}
191"#, 191"#,
192 ); 192 );
@@ -197,10 +197,10 @@ fn foo() {
197 check_diagnostics( 197 check_diagnostics(
198 r#" 198 r#"
199struct non_camel_case_name {} 199struct non_camel_case_name {}
200 // ^^^^^^^^^^^^^^^^^^^ Structure `non_camel_case_name` should have CamelCase name, e.g. `NonCamelCaseName` 200 // ^^^^^^^^^^^^^^^^^^^ 💡 weak: Structure `non_camel_case_name` should have CamelCase name, e.g. `NonCamelCaseName`
201 201
202struct SCREAMING_CASE {} 202struct SCREAMING_CASE {}
203 // ^^^^^^^^^^^^^^ Structure `SCREAMING_CASE` should have CamelCase name, e.g. `ScreamingCase` 203 // ^^^^^^^^^^^^^^ 💡 weak: Structure `SCREAMING_CASE` should have CamelCase name, e.g. `ScreamingCase`
204"#, 204"#,
205 ); 205 );
206 } 206 }
@@ -219,7 +219,7 @@ struct AABB {}
219 check_diagnostics( 219 check_diagnostics(
220 r#" 220 r#"
221struct SomeStruct { SomeField: u8 } 221struct SomeStruct { SomeField: u8 }
222 // ^^^^^^^^^ Field `SomeField` should have snake_case name, e.g. `some_field` 222 // ^^^^^^^^^ 💡 weak: Field `SomeField` should have snake_case name, e.g. `some_field`
223"#, 223"#,
224 ); 224 );
225 } 225 }
@@ -229,10 +229,10 @@ struct SomeStruct { SomeField: u8 }
229 check_diagnostics( 229 check_diagnostics(
230 r#" 230 r#"
231enum some_enum { Val(u8) } 231enum some_enum { Val(u8) }
232 // ^^^^^^^^^ Enum `some_enum` should have CamelCase name, e.g. `SomeEnum` 232 // ^^^^^^^^^ 💡 weak: Enum `some_enum` should have CamelCase name, e.g. `SomeEnum`
233 233
234enum SOME_ENUM {} 234enum SOME_ENUM {}
235 // ^^^^^^^^^ Enum `SOME_ENUM` should have CamelCase name, e.g. `SomeEnum` 235 // ^^^^^^^^^ 💡 weak: Enum `SOME_ENUM` should have CamelCase name, e.g. `SomeEnum`
236"#, 236"#,
237 ); 237 );
238 } 238 }
@@ -251,7 +251,7 @@ enum AABB {}
251 check_diagnostics( 251 check_diagnostics(
252 r#" 252 r#"
253enum SomeEnum { SOME_VARIANT(u8) } 253enum SomeEnum { SOME_VARIANT(u8) }
254 // ^^^^^^^^^^^^ Variant `SOME_VARIANT` should have CamelCase name, e.g. `SomeVariant` 254 // ^^^^^^^^^^^^ 💡 weak: Variant `SOME_VARIANT` should have CamelCase name, e.g. `SomeVariant`
255"#, 255"#,
256 ); 256 );
257 } 257 }
@@ -261,7 +261,7 @@ enum SomeEnum { SOME_VARIANT(u8) }
261 check_diagnostics( 261 check_diagnostics(
262 r#" 262 r#"
263const some_weird_const: u8 = 10; 263const some_weird_const: u8 = 10;
264 // ^^^^^^^^^^^^^^^^ Constant `some_weird_const` should have UPPER_SNAKE_CASE name, e.g. `SOME_WEIRD_CONST` 264 // ^^^^^^^^^^^^^^^^ 💡 weak: Constant `some_weird_const` should have UPPER_SNAKE_CASE name, e.g. `SOME_WEIRD_CONST`
265"#, 265"#,
266 ); 266 );
267 } 267 }
@@ -271,7 +271,7 @@ const some_weird_const: u8 = 10;
271 check_diagnostics( 271 check_diagnostics(
272 r#" 272 r#"
273static some_weird_const: u8 = 10; 273static some_weird_const: u8 = 10;
274 // ^^^^^^^^^^^^^^^^ Static variable `some_weird_const` should have UPPER_SNAKE_CASE name, e.g. `SOME_WEIRD_CONST` 274 // ^^^^^^^^^^^^^^^^ 💡 weak: Static variable `some_weird_const` should have UPPER_SNAKE_CASE name, e.g. `SOME_WEIRD_CONST`
275"#, 275"#,
276 ); 276 );
277 } 277 }
@@ -281,13 +281,13 @@ static some_weird_const: u8 = 10;
281 check_diagnostics( 281 check_diagnostics(
282 r#" 282 r#"
283struct someStruct; 283struct someStruct;
284 // ^^^^^^^^^^ Structure `someStruct` should have CamelCase name, e.g. `SomeStruct` 284 // ^^^^^^^^^^ 💡 weak: Structure `someStruct` should have CamelCase name, e.g. `SomeStruct`
285 285
286impl someStruct { 286impl someStruct {
287 fn SomeFunc(&self) { 287 fn SomeFunc(&self) {
288 // ^^^^^^^^ Function `SomeFunc` should have snake_case name, e.g. `some_func` 288 // ^^^^^^^^ 💡 weak: Function `SomeFunc` should have snake_case name, e.g. `some_func`
289 let WHY_VAR_IS_CAPS = 10; 289 let WHY_VAR_IS_CAPS = 10;
290 // ^^^^^^^^^^^^^^^ Variable `WHY_VAR_IS_CAPS` should have snake_case name, e.g. `why_var_is_caps` 290 // ^^^^^^^^^^^^^^^ 💡 weak: Variable `WHY_VAR_IS_CAPS` should have snake_case name, e.g. `why_var_is_caps`
291 } 291 }
292} 292}
293"#, 293"#,
@@ -319,7 +319,7 @@ enum Option { Some, None }
319fn main() { 319fn main() {
320 match Option::None { 320 match Option::None {
321 SOME_VAR @ None => (), 321 SOME_VAR @ None => (),
322 // ^^^^^^^^ Variable `SOME_VAR` should have snake_case name, e.g. `some_var` 322 // ^^^^^^^^ 💡 weak: Variable `SOME_VAR` should have snake_case name, e.g. `some_var`
323 Some => (), 323 Some => (),
324 } 324 }
325} 325}
@@ -421,11 +421,11 @@ extern {
421 check_diagnostics( 421 check_diagnostics(
422 r#" 422 r#"
423trait BAD_TRAIT { 423trait BAD_TRAIT {
424 // ^^^^^^^^^ Trait `BAD_TRAIT` should have CamelCase name, e.g. `BadTrait` 424 // ^^^^^^^^^ 💡 weak: Trait `BAD_TRAIT` should have CamelCase name, e.g. `BadTrait`
425 fn BAD_FUNCTION(); 425 fn BAD_FUNCTION();
426 // ^^^^^^^^^^^^ Function `BAD_FUNCTION` should have snake_case name, e.g. `bad_function` 426 // ^^^^^^^^^^^^ 💡 weak: Function `BAD_FUNCTION` should have snake_case name, e.g. `bad_function`
427 fn BadFunction(); 427 fn BadFunction();
428 // ^^^^^^^^^^^^ Function `BadFunction` should have snake_case name, e.g. `bad_function` 428 // ^^^^^^^^^^^^ 💡 weak: Function `BadFunction` should have snake_case name, e.g. `bad_function`
429} 429}
430 "#, 430 "#,
431 ); 431 );