Reduce usage of as_ref and as_mut.

This commit is contained in:
Stephen Chung
2022-07-05 16:26:38 +08:00
parent 9319f87a7b
commit b6528bd51d
33 changed files with 211 additions and 137 deletions

View File

@@ -178,7 +178,7 @@ impl CallableFunction {
#[must_use]
pub fn get_iter_fn(&self) -> Option<&IteratorFn> {
match self {
Self::Iterator(f) => Some(f.as_ref()),
Self::Iterator(f) => Some(&**f),
Self::Pure(..) | Self::Method(..) | Self::Plugin(..) => None,
#[cfg(not(feature = "no_function"))]

View File

@@ -110,7 +110,7 @@ impl<'a, M: AsRef<[&'a Module]> + ?Sized, S: AsRef<str> + 'a + ?Sized>
Self {
engine: value.0,
fn_name: value.1.as_ref(),
source: value.2.map(S::as_ref),
source: value.2.map(<_>::as_ref),
global: Some(value.3),
lib: value.4.as_ref(),
pos: value.5,

View File

@@ -131,7 +131,7 @@ impl Engine {
lib
} else {
caches.push_fn_resolution_cache();
lib_merged.push(fn_lib.as_ref());
lib_merged.push(&**fn_lib);
lib_merged.extend(lib.iter().cloned());
&lib_merged
},