diff --git a/ast/src/lang/env.rs b/ast/src/lang/env.rs index 7e7f5a1670..0af9303543 100644 --- a/ast/src/lang/env.rs +++ b/ast/src/lang/env.rs @@ -129,8 +129,8 @@ impl<'a> Env<'a> { region, }, self.ident_ids - .idents() - .map(|(_, string)| string.as_ref().into()) + .ident_strs() + .map(|(_, string)| string.into()) .collect(), )), } @@ -146,9 +146,9 @@ impl<'a> Env<'a> { } None => { let exposed_values = exposed_ids - .idents() + .ident_strs() .filter(|(_, ident)| { - ident.as_ref().starts_with(|c: char| c.is_lowercase()) + ident.starts_with(|c: char| c.is_lowercase()) }) .map(|(_, ident)| Lowercase::from(ident.as_ref())) .collect(); diff --git a/ast/src/lang/scope.rs b/ast/src/lang/scope.rs index b01c818064..26b82b25d7 100644 --- a/ast/src/lang/scope.rs +++ b/ast/src/lang/scope.rs @@ -327,9 +327,9 @@ impl Scope { ) -> ASTResult<()> { let ident_ids = get_module_ident_ids(all_ident_ids, &env.home)?.clone(); - for (_, ident_ref) in ident_ids.idents() { + for (_, ident_ref) in ident_ids.ident_strs() { self.introduce( - ident_ref.as_inline_str().as_str().into(), + ident_ref.into(), &env.exposed_ident_ids, get_module_ident_ids_mut(all_ident_ids, &env.home)?, Region::zero(), diff --git a/compiler/can/src/env.rs b/compiler/can/src/env.rs index 40523b2fb7..2c7a28ad69 100644 --- a/compiler/can/src/env.rs +++ b/compiler/can/src/env.rs @@ -104,8 +104,8 @@ impl<'a> Env<'a> { region, }, self.ident_ids - .idents() - .map(|(_, string)| string.as_ref().into()) + .ident_strs() + .map(|(_, string)| string.into()) .collect(), ); Err(error) @@ -127,9 +127,9 @@ impl<'a> Env<'a> { } None => { let exposed_values = exposed_ids - .idents() + .ident_strs() .filter(|(_, ident)| { - ident.as_ref().starts_with(|c: char| c.is_lowercase()) + ident.starts_with(|c: char| c.is_lowercase()) }) .map(|(_, ident)| Lowercase::from(ident.as_ref())) .collect(); diff --git a/compiler/module/src/symbol.rs b/compiler/module/src/symbol.rs index 391a31600d..86648dc9b9 100644 --- a/compiler/module/src/symbol.rs +++ b/compiler/module/src/symbol.rs @@ -542,11 +542,11 @@ pub struct IdentIds { } impl IdentIds { - pub fn idents(&self) -> impl Iterator { + pub fn ident_strs(&self) -> impl Iterator { self.by_id .iter() .enumerate() - .map(|(index, ident)| (IdentId(index as u32), ident)) + .map(|(index, ident)| (IdentId(index as u32), ident.as_inline_str().as_str())) } pub fn add(&mut self, ident_name: Ident) -> IdentId { @@ -639,8 +639,10 @@ impl IdentIds { #[inline(always)] pub fn get_id(&self, ident_name: &Ident) -> Option { - for (id, ident) in self.idents() { - if ident_name == ident { + let ident_name = ident_name.as_inline_str().as_str(); + + for (id, ident_str) in self.ident_strs() { + if ident_name == ident_str { return Some(id); } }