diff options
author | Igor Aleksanov <[email protected]> | 2020-10-31 09:43:03 +0000 |
---|---|---|
committer | Igor Aleksanov <[email protected]> | 2020-11-03 07:11:02 +0000 |
commit | 9e172ffeb7c01df25097d7888b23a39505cb5aed (patch) | |
tree | ba340717567c3e11f4e58c1c2601b59b0839fc26 /crates/hir_ty/src | |
parent | bdfe12df8fd055bfa4bbcd0493c285e2e48dfd13 (diff) |
Remove numbers from comments in decl_check.rs
Diffstat (limited to 'crates/hir_ty/src')
-rw-r--r-- | crates/hir_ty/src/diagnostics/decl_check.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/crates/hir_ty/src/diagnostics/decl_check.rs b/crates/hir_ty/src/diagnostics/decl_check.rs index bc33ad09a..93d61589c 100644 --- a/crates/hir_ty/src/diagnostics/decl_check.rs +++ b/crates/hir_ty/src/diagnostics/decl_check.rs | |||
@@ -89,18 +89,18 @@ impl<'a, 'b> DeclValidator<'a, 'b> { | |||
89 | let data = db.function_data(func); | 89 | let data = db.function_data(func); |
90 | let body = db.body(func.into()); | 90 | let body = db.body(func.into()); |
91 | 91 | ||
92 | // 1. Recursively validate inner scope items, such as static variables and constants. | 92 | // Recursively validate inner scope items, such as static variables and constants. |
93 | for (item_id, _) in body.item_scope.values() { | 93 | for (item_id, _) in body.item_scope.values() { |
94 | let mut validator = DeclValidator::new(item_id, self.sink); | 94 | let mut validator = DeclValidator::new(item_id, self.sink); |
95 | validator.validate_item(db); | 95 | validator.validate_item(db); |
96 | } | 96 | } |
97 | 97 | ||
98 | // 2. Check whether non-snake case identifiers are allowed for this function. | 98 | // Check whether non-snake case identifiers are allowed for this function. |
99 | if self.allowed(db, func.into(), allow::NON_SNAKE_CASE) { | 99 | if self.allowed(db, func.into(), allow::NON_SNAKE_CASE) { |
100 | return; | 100 | return; |
101 | } | 101 | } |
102 | 102 | ||
103 | // 2. Check the function name. | 103 | // Check the function name. |
104 | let function_name = data.name.to_string(); | 104 | let function_name = data.name.to_string(); |
105 | let fn_name_replacement = if let Some(new_name) = to_lower_snake_case(&function_name) { | 105 | let fn_name_replacement = if let Some(new_name) = to_lower_snake_case(&function_name) { |
106 | let replacement = Replacement { | 106 | let replacement = Replacement { |
@@ -113,7 +113,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> { | |||
113 | None | 113 | None |
114 | }; | 114 | }; |
115 | 115 | ||
116 | // 3. Check the param names. | 116 | // Check the param names. |
117 | let mut fn_param_replacements = Vec::new(); | 117 | let mut fn_param_replacements = Vec::new(); |
118 | 118 | ||
119 | for pat_id in body.params.iter().cloned() { | 119 | for pat_id in body.params.iter().cloned() { |
@@ -135,7 +135,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> { | |||
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | // 4. Check the patterns inside the function body. | 138 | // Check the patterns inside the function body. |
139 | let mut pats_replacements = Vec::new(); | 139 | let mut pats_replacements = Vec::new(); |
140 | 140 | ||
141 | for (pat_idx, pat) in body.pats.iter() { | 141 | for (pat_idx, pat) in body.pats.iter() { |
@@ -160,7 +160,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> { | |||
160 | } | 160 | } |
161 | } | 161 | } |
162 | 162 | ||
163 | // 5. If there is at least one element to spawn a warning on, go to the source map and generate a warning. | 163 | // If there is at least one element to spawn a warning on, go to the source map and generate a warning. |
164 | self.create_incorrect_case_diagnostic_for_func( | 164 | self.create_incorrect_case_diagnostic_for_func( |
165 | func, | 165 | func, |
166 | db, | 166 | db, |
@@ -187,7 +187,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> { | |||
187 | let fn_loc = func.lookup(db.upcast()); | 187 | let fn_loc = func.lookup(db.upcast()); |
188 | let fn_src = fn_loc.source(db.upcast()); | 188 | let fn_src = fn_loc.source(db.upcast()); |
189 | 189 | ||
190 | // 1. Diagnostic for function name. | 190 | // Diagnostic for function name. |
191 | if let Some(replacement) = fn_name_replacement { | 191 | if let Some(replacement) = fn_name_replacement { |
192 | let ast_ptr = match fn_src.value.name() { | 192 | let ast_ptr = match fn_src.value.name() { |
193 | Some(name) => name, | 193 | Some(name) => name, |
@@ -214,7 +214,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> { | |||
214 | self.sink.push(diagnostic); | 214 | self.sink.push(diagnostic); |
215 | } | 215 | } |
216 | 216 | ||
217 | // 2. Diagnostics for function params. | 217 | // Diagnostics for function params. |
218 | let fn_params_list = match fn_src.value.param_list() { | 218 | let fn_params_list = match fn_src.value.param_list() { |
219 | Some(params) => params, | 219 | Some(params) => params, |
220 | None => { | 220 | None => { |
@@ -334,7 +334,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> { | |||
334 | self.allowed(db, struct_id.into(), allow::NON_CAMEL_CASE_TYPES); | 334 | self.allowed(db, struct_id.into(), allow::NON_CAMEL_CASE_TYPES); |
335 | let non_snake_case_allowed = self.allowed(db, struct_id.into(), allow::NON_SNAKE_CASE); | 335 | let non_snake_case_allowed = self.allowed(db, struct_id.into(), allow::NON_SNAKE_CASE); |
336 | 336 | ||
337 | // 1. Check the structure name. | 337 | // Check the structure name. |
338 | let struct_name = data.name.to_string(); | 338 | let struct_name = data.name.to_string(); |
339 | let struct_name_replacement = if let Some(new_name) = to_camel_case(&struct_name) { | 339 | let struct_name_replacement = if let Some(new_name) = to_camel_case(&struct_name) { |
340 | let replacement = Replacement { | 340 | let replacement = Replacement { |
@@ -351,7 +351,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> { | |||
351 | None | 351 | None |
352 | }; | 352 | }; |
353 | 353 | ||
354 | // 2. Check the field names. | 354 | // Check the field names. |
355 | let mut struct_fields_replacements = Vec::new(); | 355 | let mut struct_fields_replacements = Vec::new(); |
356 | 356 | ||
357 | if !non_snake_case_allowed { | 357 | if !non_snake_case_allowed { |
@@ -370,7 +370,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> { | |||
370 | } | 370 | } |
371 | } | 371 | } |
372 | 372 | ||
373 | // 3. If there is at least one element to spawn a warning on, go to the source map and generate a warning. | 373 | // If there is at least one element to spawn a warning on, go to the source map and generate a warning. |
374 | self.create_incorrect_case_diagnostic_for_struct( | 374 | self.create_incorrect_case_diagnostic_for_struct( |
375 | struct_id, | 375 | struct_id, |
376 | db, | 376 | db, |
@@ -470,12 +470,12 @@ impl<'a, 'b> DeclValidator<'a, 'b> { | |||
470 | fn validate_enum(&mut self, db: &dyn HirDatabase, enum_id: EnumId) { | 470 | fn validate_enum(&mut self, db: &dyn HirDatabase, enum_id: EnumId) { |
471 | let data = db.enum_data(enum_id); | 471 | let data = db.enum_data(enum_id); |
472 | 472 | ||
473 | // 1. Check whether non-camel case names are allowed for this enum. | 473 | // Check whether non-camel case names are allowed for this enum. |
474 | if self.allowed(db, enum_id.into(), allow::NON_CAMEL_CASE_TYPES) { | 474 | if self.allowed(db, enum_id.into(), allow::NON_CAMEL_CASE_TYPES) { |
475 | return; | 475 | return; |
476 | } | 476 | } |
477 | 477 | ||
478 | // 2. Check the enum name. | 478 | // Check the enum name. |
479 | let enum_name = data.name.to_string(); | 479 | let enum_name = data.name.to_string(); |
480 | let enum_name_replacement = if let Some(new_name) = to_camel_case(&enum_name) { | 480 | let enum_name_replacement = if let Some(new_name) = to_camel_case(&enum_name) { |
481 | let replacement = Replacement { | 481 | let replacement = Replacement { |
@@ -488,7 +488,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> { | |||
488 | None | 488 | None |
489 | }; | 489 | }; |
490 | 490 | ||
491 | // 3. Check the field names. | 491 | // Check the field names. |
492 | let mut enum_fields_replacements = Vec::new(); | 492 | let mut enum_fields_replacements = Vec::new(); |
493 | 493 | ||
494 | for (_, variant) in data.variants.iter() { | 494 | for (_, variant) in data.variants.iter() { |
@@ -503,7 +503,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> { | |||
503 | } | 503 | } |
504 | } | 504 | } |
505 | 505 | ||
506 | // 4. If there is at least one element to spawn a warning on, go to the source map and generate a warning. | 506 | // If there is at least one element to spawn a warning on, go to the source map and generate a warning. |
507 | self.create_incorrect_case_diagnostic_for_enum( | 507 | self.create_incorrect_case_diagnostic_for_enum( |
508 | enum_id, | 508 | enum_id, |
509 | db, | 509 | db, |