mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 14:13:58 +00:00
Better lowercase/uppercase checks
This commit is contained in:
parent
707a5683b1
commit
796c4d8a10
2 changed files with 2 additions and 2 deletions
|
@ -41,7 +41,7 @@ pub(crate) fn generate_enum_variant(acc: &mut Assists, ctx: &AssistContext) -> O
|
|||
}
|
||||
|
||||
let name_ref = path.segment()?.name_ref()?;
|
||||
if name_ref.text().as_str().chars().next()?.is_ascii_lowercase() {
|
||||
if name_ref.text().starts_with(char::is_lowercase) {
|
||||
// Don't suggest generating variant if the name starts with a lowercase letter
|
||||
return None;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ fn gen_fn(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
|
|||
Some(hir::PathResolution::Def(hir::ModuleDef::Adt(adt))) => {
|
||||
if let hir::Adt::Enum(_) = adt {
|
||||
// Don't suggest generating function if the name starts with an uppercase letter
|
||||
if name_ref.text().chars().next()?.is_uppercase() {
|
||||
if name_ref.text().starts_with(char::is_uppercase) {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue