Satisfy clippy.
This commit is contained in:
@@ -77,16 +77,9 @@ impl ModuleResolversCollection {
|
||||
}
|
||||
/// Get an iterator of all the [module resolvers][ModuleResolver].
|
||||
#[inline(always)]
|
||||
#[must_use]
|
||||
pub fn iter(&self) -> impl Iterator<Item = &dyn ModuleResolver> {
|
||||
self.0.iter().map(|v| v.as_ref())
|
||||
}
|
||||
/// Get a mutable iterator of all the [module resolvers][ModuleResolver].
|
||||
#[inline(always)]
|
||||
#[must_use]
|
||||
pub fn into_iter(self) -> impl Iterator<Item = Box<dyn ModuleResolver>> {
|
||||
self.0.into_iter()
|
||||
}
|
||||
/// Remove all [module resolvers][ModuleResolver].
|
||||
#[inline(always)]
|
||||
pub fn clear(&mut self) -> &mut Self {
|
||||
@@ -114,6 +107,16 @@ impl ModuleResolversCollection {
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoIterator for ModuleResolversCollection {
|
||||
type Item = Box<dyn ModuleResolver>;
|
||||
type IntoIter = std::vec::IntoIter<Box<dyn ModuleResolver>>;
|
||||
|
||||
#[inline(always)]
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
self.0.into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
impl ModuleResolver for ModuleResolversCollection {
|
||||
fn resolve(
|
||||
&self,
|
||||
|
@@ -23,7 +23,6 @@ pub use stat::StaticModuleResolver;
|
||||
/// Trait that encapsulates a module resolution service.
|
||||
pub trait ModuleResolver: SendSync {
|
||||
/// Resolve a module based on a path string.
|
||||
#[must_use]
|
||||
fn resolve(
|
||||
&self,
|
||||
engine: &Engine,
|
||||
|
@@ -64,33 +64,28 @@ impl StaticModuleResolver {
|
||||
}
|
||||
/// Get an iterator of all the [modules][Module].
|
||||
#[inline(always)]
|
||||
#[must_use]
|
||||
pub fn iter(&self) -> impl Iterator<Item = (&str, &Shared<Module>)> {
|
||||
self.0.iter().map(|(k, v)| (k.as_str(), v))
|
||||
}
|
||||
/// Get a mutable iterator of all the [modules][Module].
|
||||
#[inline(always)]
|
||||
#[must_use]
|
||||
pub fn iter_mut(&mut self) -> impl Iterator<Item = (&str, &mut Shared<Module>)> {
|
||||
self.0.iter_mut().map(|(k, v)| (k.as_str(), v))
|
||||
}
|
||||
/// Get a mutable iterator of all the modules.
|
||||
#[inline(always)]
|
||||
#[must_use]
|
||||
pub fn into_iter(self) -> impl Iterator<Item = (Identifier, Shared<Module>)> {
|
||||
self.0.into_iter()
|
||||
}
|
||||
/// Get an iterator of all the [module][Module] paths.
|
||||
#[inline(always)]
|
||||
#[must_use]
|
||||
pub fn paths(&self) -> impl Iterator<Item = &str> {
|
||||
self.0.keys().map(|s| s.as_str())
|
||||
}
|
||||
/// Get an iterator of all the [modules][Module].
|
||||
#[inline(always)]
|
||||
#[must_use]
|
||||
pub fn values(&self) -> impl Iterator<Item = &Shared<Module>> {
|
||||
self.0.values().map(|m| m)
|
||||
self.0.values()
|
||||
}
|
||||
/// Remove all [modules][Module].
|
||||
#[inline(always)]
|
||||
|
Reference in New Issue
Block a user