mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-11 18:58:24 +03:00
use std::starts_with
instead of iterator logic
This commit is contained in:
parent
86726e03e3
commit
2cabe6546c
@ -226,8 +226,7 @@ fn loc_term<'a>(options: ExprParseOptions) -> impl Parser<'a, Loc<Expr<'a>>, EEx
|
||||
}
|
||||
|
||||
fn ident_seq<'a>() -> impl Parser<'a, Loc<Expr<'a>>, EExpr<'a>> {
|
||||
(|arena: &'a Bump, state: State<'a>, min_indent: u32| parse_ident_seq(arena, state, min_indent))
|
||||
.trace("ident_seq")
|
||||
parse_ident_seq.trace("ident_seq")
|
||||
}
|
||||
|
||||
fn parse_ident_seq<'a>(
|
||||
|
@ -255,7 +255,7 @@ impl AnalyzedDocument {
|
||||
let is_module_completion = symbol_prefix
|
||||
.split('.')
|
||||
.nth_back(1) // second to last
|
||||
.and_then(|str| str.chars().nth(0).map(|c| c.is_uppercase()))
|
||||
.map(|str| str.starts_with(|c: char| c.is_uppercase()))
|
||||
.unwrap_or(false);
|
||||
|
||||
if is_module_completion {
|
||||
@ -279,10 +279,8 @@ impl AnalyzedDocument {
|
||||
)
|
||||
}
|
||||
} else {
|
||||
let is_module_or_type_completion = symbol_prefix
|
||||
.chars()
|
||||
.nth(0)
|
||||
.map_or(false, |c| c.is_uppercase());
|
||||
let is_module_or_type_completion =
|
||||
symbol_prefix.starts_with(|c: char| c.is_uppercase());
|
||||
|
||||
if is_module_or_type_completion {
|
||||
info!("Getting module completion...");
|
||||
|
@ -92,7 +92,7 @@ impl HasToken for ModuleName<'_> {
|
||||
|
||||
impl HasToken for &str {
|
||||
fn token(&self) -> Token {
|
||||
if self.chars().next().unwrap().is_uppercase() {
|
||||
if self.starts_with(|c: char| c.is_uppercase()) {
|
||||
Token::Type
|
||||
} else {
|
||||
Token::Variable
|
||||
|
Loading…
Reference in New Issue
Block a user