Use Ident.

This commit is contained in:
Stephen Chung
2020-11-01 00:04:02 +08:00
parent abbee80e5d
commit 629e02f9da
4 changed files with 24 additions and 24 deletions

View File

@@ -591,7 +591,7 @@ pub fn search_imports<'s>(
state: &mut State,
modules: &ModuleRef,
) -> Result<&'s Module, Box<EvalAltResult>> {
let (root, root_pos) = &modules[0];
let Ident { name: root, pos } = &modules[0];
// Qualified - check if the root module is directly indexed
let index = if state.always_search {
@@ -608,7 +608,7 @@ pub fn search_imports<'s>(
.rev()
.find(|(n, _)| n == root)
.map(|(_, m)| m)
.ok_or_else(|| EvalAltResult::ErrorModuleNotFound(root.to_string(), *root_pos))?
.ok_or_else(|| EvalAltResult::ErrorModuleNotFound(root.to_string(), *pos))?
})
}
@@ -619,7 +619,7 @@ pub fn search_imports_mut<'s>(
state: &mut State,
modules: &ModuleRef,
) -> Result<&'s mut Module, Box<EvalAltResult>> {
let (root, root_pos) = &modules[0];
let Ident { name: root, pos } = &modules[0];
// Qualified - check if the root module is directly indexed
let index = if state.always_search {
@@ -636,7 +636,7 @@ pub fn search_imports_mut<'s>(
.rev()
.find(|(n, _)| n == root)
.map(|(_, m)| m)
.ok_or_else(|| EvalAltResult::ErrorModuleNotFound(root.to_string(), *root_pos))?
.ok_or_else(|| EvalAltResult::ErrorModuleNotFound(root.to_string(), *pos))?
})
}