|
1 | 1 | #![allow(clippy::unwrap_used, clippy::expect_used)] |
2 | 2 | use crate::build::{Origin, Outcome, Runtime, Target}; |
3 | 3 | use crate::diagnostic::{Diagnostic, ExtraLabel, Label, Location}; |
4 | | -use crate::strings::{to_snake_case, to_upper_camel_case, uppercase_first_letter}; |
| 4 | +use crate::strings::{to_snake_case, to_upper_camel_case}; |
5 | 5 | use crate::type_::collapse_links; |
6 | 6 | use crate::type_::error::{ |
7 | 7 | InvalidImportKind, MissingAnnotation, ModuleValueUsageContext, Named, UnknownField, |
@@ -3512,29 +3512,29 @@ See: https://tour.gleam.run/advanced-features/use/"); |
3512 | 3512 |
|
3513 | 3513 | TypeError::BadName { location, name, kind } => { |
3514 | 3514 | let kind_str = kind.as_str(); |
3515 | | - let label = format!("This is not a valid {kind_str} name"); |
| 3515 | + let label = format!("This is not a valid {} name", kind_str.to_lowercase()); |
3516 | 3516 | let text = match kind { |
3517 | 3517 | Named::Type | |
3518 | 3518 | Named::TypeAlias | |
3519 | 3519 | Named::CustomTypeVariant => wrap_format!("Hint: {} names start with an uppercase \ |
3520 | 3520 | letter and contain only lowercase letters, numbers, \ |
3521 | 3521 | and uppercase letters. |
3522 | | -Try: {}", uppercase_first_letter(kind_str), to_upper_camel_case(name)), |
| 3522 | +Try: {}", kind_str, to_upper_camel_case(name)), |
3523 | 3523 | Named::Variable | |
3524 | 3524 | Named::TypeVariable | |
3525 | 3525 | Named::Argument | |
3526 | 3526 | Named::Label | |
3527 | 3527 | Named::Constant | |
3528 | 3528 | Named::Function => wrap_format!("Hint: {} names start with a lowercase letter \ |
3529 | 3529 | and contain a-z, 0-9, or _. |
3530 | | -Try: {}", uppercase_first_letter(kind_str), to_snake_case(name)), |
| 3530 | +Try: {}", kind_str, to_snake_case(name)), |
3531 | 3531 | Named::Discard => wrap_format!("Hint: {} names start with _ and contain \ |
3532 | 3532 | a-z, 0-9, or _. |
3533 | | -Try: _{}", uppercase_first_letter(kind_str), to_snake_case(name)), |
| 3533 | +Try: _{}", kind_str, to_snake_case(name)), |
3534 | 3534 | }; |
3535 | 3535 |
|
3536 | 3536 | Diagnostic { |
3537 | | - title: format!("Invalid {kind_str} name"), |
| 3537 | + title: format!("Invalid {} name", kind_str.to_lowercase()), |
3538 | 3538 | text, |
3539 | 3539 | hint: None, |
3540 | 3540 | level: Level::Error, |
|
0 commit comments