aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty
diff options
context:
space:
mode:
authorIgor Aleksanov <[email protected]>2020-10-08 06:33:35 +0100
committerIgor Aleksanov <[email protected]>2020-10-12 09:05:00 +0100
commit559cc970732d80e3ec624c20da4f8aac219d6b2e (patch)
treecc0efeae2653890f8c178c4b970851d7fc9552af /crates/hir_ty
parentebd30033b3743fafe0a0182b5ae34ffb27fe43ff (diff)
Add to_upper_snake_case function to stdx
Diffstat (limited to 'crates/hir_ty')
-rw-r--r--crates/hir_ty/src/diagnostics/decl_check.rs4
-rw-r--r--crates/hir_ty/src/diagnostics/decl_check/case_conv.rs (renamed from crates/hir_ty/src/diagnostics/decl_check/str_helpers.rs)3
2 files changed, 3 insertions, 4 deletions
diff --git a/crates/hir_ty/src/diagnostics/decl_check.rs b/crates/hir_ty/src/diagnostics/decl_check.rs
index 4c20921e5..901ccc94f 100644
--- a/crates/hir_ty/src/diagnostics/decl_check.rs
+++ b/crates/hir_ty/src/diagnostics/decl_check.rs
@@ -10,7 +10,7 @@
10//! - static items (e.g. `static FOO: u8 = 10;`) 10//! - static items (e.g. `static FOO: u8 = 10;`)
11//! - match arm bindings (e.g. `foo @ Some(_)`) 11//! - match arm bindings (e.g. `foo @ Some(_)`)
12 12
13mod str_helpers; 13mod case_conv;
14 14
15use hir_def::{ 15use hir_def::{
16 adt::VariantData, 16 adt::VariantData,
@@ -29,7 +29,7 @@ use syntax::{
29 29
30use crate::{ 30use crate::{
31 db::HirDatabase, 31 db::HirDatabase,
32 diagnostics::{decl_check::str_helpers::*, CaseType, IncorrectCase}, 32 diagnostics::{decl_check::case_conv::*, CaseType, IncorrectCase},
33}; 33};
34 34
35pub(super) struct DeclValidator<'a, 'b: 'a> { 35pub(super) struct DeclValidator<'a, 'b: 'a> {
diff --git a/crates/hir_ty/src/diagnostics/decl_check/str_helpers.rs b/crates/hir_ty/src/diagnostics/decl_check/case_conv.rs
index 2e1468c4c..3800f2a6b 100644
--- a/crates/hir_ty/src/diagnostics/decl_check/str_helpers.rs
+++ b/crates/hir_ty/src/diagnostics/decl_check/case_conv.rs
@@ -136,8 +136,7 @@ pub fn to_upper_snake_case(ident: &str) -> Option<String> {
136 } 136 }
137 137
138 // Normalize the string from whatever form it's in currently, and then just make it uppercase. 138 // Normalize the string from whatever form it's in currently, and then just make it uppercase.
139 let upper_snake_case = 139 let upper_snake_case = stdx::to_upper_snake_case(ident);
140 stdx::to_lower_snake_case(ident).chars().map(|c| c.to_ascii_uppercase()).collect();
141 140
142 if upper_snake_case == ident { 141 if upper_snake_case == ident {
143 // While we didn't detect the correct case at the beginning, there 142 // While we didn't detect the correct case at the beginning, there