mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Add to_upper_snake_case function to stdx
This commit is contained in:
parent
ebd30033b3
commit
559cc97073
3 changed files with 13 additions and 6 deletions
|
@ -10,7 +10,7 @@
|
|||
//! - static items (e.g. `static FOO: u8 = 10;`)
|
||||
//! - match arm bindings (e.g. `foo @ Some(_)`)
|
||||
|
||||
mod str_helpers;
|
||||
mod case_conv;
|
||||
|
||||
use hir_def::{
|
||||
adt::VariantData,
|
||||
|
@ -29,7 +29,7 @@ use syntax::{
|
|||
|
||||
use crate::{
|
||||
db::HirDatabase,
|
||||
diagnostics::{decl_check::str_helpers::*, CaseType, IncorrectCase},
|
||||
diagnostics::{decl_check::case_conv::*, CaseType, IncorrectCase},
|
||||
};
|
||||
|
||||
pub(super) struct DeclValidator<'a, 'b: 'a> {
|
||||
|
|
|
@ -136,8 +136,7 @@ pub fn to_upper_snake_case(ident: &str) -> Option<String> {
|
|||
}
|
||||
|
||||
// Normalize the string from whatever form it's in currently, and then just make it uppercase.
|
||||
let upper_snake_case =
|
||||
stdx::to_lower_snake_case(ident).chars().map(|c| c.to_ascii_uppercase()).collect();
|
||||
let upper_snake_case = stdx::to_upper_snake_case(ident);
|
||||
|
||||
if upper_snake_case == ident {
|
||||
// While we didn't detect the correct case at the beginning, there
|
Loading…
Add table
Add a link
Reference in a new issue