Simplify using ..
This commit is contained in:
@@ -1402,7 +1402,7 @@ impl Module {
|
||||
/// Sub-modules are flattened onto the root [`Module`], with higher level overriding lower level.
|
||||
#[inline]
|
||||
pub fn combine_flatten(&mut self, other: Self) -> &mut Self {
|
||||
for (_, m) in other.modules.into_iter() {
|
||||
for (.., m) in other.modules.into_iter() {
|
||||
self.combine_flatten(shared_take_or_clone(m));
|
||||
}
|
||||
self.variables.extend(other.variables.into_iter());
|
||||
@@ -1471,7 +1471,7 @@ impl Module {
|
||||
other
|
||||
.functions
|
||||
.iter()
|
||||
.filter(|&(_, f)| {
|
||||
.filter(|&(.., f)| {
|
||||
_filter(
|
||||
f.metadata.namespace,
|
||||
f.metadata.access,
|
||||
@@ -1502,7 +1502,7 @@ impl Module {
|
||||
) -> &mut Self {
|
||||
self.functions = std::mem::take(&mut self.functions)
|
||||
.into_iter()
|
||||
.filter(|(_, f)| {
|
||||
.filter(|(.., f)| {
|
||||
if f.func.is_script() {
|
||||
filter(
|
||||
f.metadata.namespace,
|
||||
@@ -1717,7 +1717,7 @@ impl Module {
|
||||
result?;
|
||||
|
||||
// Variables with an alias left in the scope become module variables
|
||||
for (_, value, mut aliases) in scope {
|
||||
for (.., value, mut aliases) in scope {
|
||||
match aliases.len() {
|
||||
0 => (),
|
||||
1 => {
|
||||
|
@@ -128,7 +128,7 @@ impl ModuleResolver for ModuleResolversCollection {
|
||||
match resolver.resolve(engine, source_path, path, pos) {
|
||||
Ok(module) => return Ok(module),
|
||||
Err(err) => match *err {
|
||||
ERR::ErrorModuleNotFound(_, _) => continue,
|
||||
ERR::ErrorModuleNotFound(..) => continue,
|
||||
ERR::ErrorInModule(_, err, _) => return Err(err),
|
||||
_ => panic!("ModuleResolver::resolve returns error that is not ErrorModuleNotFound or ErrorInModule"),
|
||||
},
|
||||
|
@@ -230,7 +230,7 @@ impl FileModuleResolver {
|
||||
|
||||
locked_write(&self.cache)
|
||||
.remove_entry(&file_path)
|
||||
.map(|(_, v)| v)
|
||||
.map(|(.., v)| v)
|
||||
}
|
||||
/// Construct a full file path.
|
||||
#[must_use]
|
||||
@@ -288,7 +288,7 @@ impl FileModuleResolver {
|
||||
let mut ast = engine
|
||||
.compile_file(file_path.clone())
|
||||
.map_err(|err| match *err {
|
||||
ERR::ErrorSystem(_, err) if err.is::<IoError>() => {
|
||||
ERR::ErrorSystem(.., err) if err.is::<IoError>() => {
|
||||
Box::new(ERR::ErrorModuleNotFound(path.to_string(), pos))
|
||||
}
|
||||
_ => Box::new(ERR::ErrorInModule(path.to_string(), err, pos)),
|
||||
@@ -356,7 +356,7 @@ impl ModuleResolver for FileModuleResolver {
|
||||
ast
|
||||
})
|
||||
.map_err(|err| match *err {
|
||||
ERR::ErrorSystem(_, err) if err.is::<IoError>() => {
|
||||
ERR::ErrorSystem(.., err) if err.is::<IoError>() => {
|
||||
ERR::ErrorModuleNotFound(path.to_string(), pos).into()
|
||||
}
|
||||
_ => ERR::ErrorInModule(path.to_string(), err, pos).into(),
|
||||
|
Reference in New Issue
Block a user