mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
clippy
This commit is contained in:
parent
4ad5e532c1
commit
a78aff0f2f
2 changed files with 15 additions and 23 deletions
|
@ -430,33 +430,19 @@ impl ScopedIdentIds {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_symbol(&self, ident: &Ident) -> Option<Symbol> {
|
|
||||||
self.ident_ids
|
|
||||||
.ident_strs()
|
|
||||||
.zip(self.in_scope.iter())
|
|
||||||
.find_map(|((ident_id, string), keep)| {
|
|
||||||
if *keep && string == ident.as_str() {
|
|
||||||
Some(Symbol::new(self.home, ident_id))
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn has_in_scope(&self, ident: &Ident) -> Option<(Symbol, Region)> {
|
fn has_in_scope(&self, ident: &Ident) -> Option<(Symbol, Region)> {
|
||||||
self.ident_ids
|
for index in self.in_scope.iter_ones() {
|
||||||
.ident_strs()
|
if let Some((ident_id, string)) = self.ident_ids.get_name_at_index(index) {
|
||||||
.zip(self.in_scope.iter())
|
if string == ident.as_str() {
|
||||||
.find_map(|((ident_id, string), keep)| {
|
return Some((
|
||||||
if *keep && string == ident.as_str() {
|
|
||||||
Some((
|
|
||||||
Symbol::new(self.home, ident_id),
|
Symbol::new(self.home, ident_id),
|
||||||
self.regions[ident_id.index()],
|
self.regions[ident_id.index()],
|
||||||
))
|
));
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn idents_in_scope(&self) -> impl Iterator<Item = Ident> + '_ {
|
fn idents_in_scope(&self) -> impl Iterator<Item = Ident> + '_ {
|
||||||
|
|
|
@ -584,6 +584,12 @@ impl IdentIds {
|
||||||
self.interner.try_get(id.0 as usize)
|
self.interner.try_get(id.0 as usize)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_name_at_index(&self, index: usize) -> Option<(IdentId, &str)> {
|
||||||
|
self.interner
|
||||||
|
.try_get(index)
|
||||||
|
.map(|v| (IdentId(index as u32), v))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_name_str_res(&self, ident_id: IdentId) -> ModuleResult<&str> {
|
pub fn get_name_str_res(&self, ident_id: IdentId) -> ModuleResult<&str> {
|
||||||
self.get_name(ident_id).with_context(|| IdentIdNotFound {
|
self.get_name(ident_id).with_context(|| IdentIdNotFound {
|
||||||
ident_id,
|
ident_id,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue