diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-07-25 16:16:33 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-07-25 16:17:10 +0900 |
| commit | 432472808051cb4f1bb9517b858dbc810aaa5a63 (patch) | |
| tree | 4c58b97942853ea2c3f58368203fa93187746cf8 /crates/shirabe/src/autoload/class_loader.rs | |
| parent | d4608662f28b9a5135986b1702afe3199957eabe (diff) | |
| download | php-shirabe-432472808051cb4f1bb9517b858dbc810aaa5a63.tar.gz php-shirabe-432472808051cb4f1bb9517b858dbc810aaa5a63.tar.zst php-shirabe-432472808051cb4f1bb9517b858dbc810aaa5a63.zip | |
refactor: replace redundant clones with moves
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/autoload/class_loader.rs')
| -rw-r--r-- | crates/shirabe/src/autoload/class_loader.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/shirabe/src/autoload/class_loader.rs b/crates/shirabe/src/autoload/class_loader.rs index 3ebb7a7d..3bcc6f81 100644 --- a/crates/shirabe/src/autoload/class_loader.rs +++ b/crates/shirabe/src/autoload/class_loader.rs @@ -131,7 +131,7 @@ impl ClassLoader { pub fn add(&mut self, prefix: &str, paths: Vec<String>, prepend: bool) { if prefix.is_empty() { if prepend { - let mut new_dirs = paths.clone(); + let mut new_dirs = paths; new_dirs.append(&mut self.fallback_dirs_psr0); self.fallback_dirs_psr0 = new_dirs; } else { @@ -142,14 +142,14 @@ impl ClassLoader { } let first = prefix.chars().next().unwrap_or('\0').to_string(); - let entry = self.prefixes_psr0.entry(first.clone()).or_default(); + let entry = self.prefixes_psr0.entry(first).or_default(); if !entry.contains_key(prefix) { entry.insert(prefix.to_string(), paths); return; } let existing = entry.get_mut(prefix).unwrap(); if prepend { - let mut new_dirs = paths.clone(); + let mut new_dirs = paths; new_dirs.append(existing); *existing = new_dirs; } else { @@ -170,7 +170,7 @@ impl ClassLoader { if prefix.is_empty() { // Register directories for the root namespace. if prepend { - let mut new_dirs = paths.clone(); + let mut new_dirs = paths; new_dirs.append(&mut self.fallback_dirs_psr4); self.fallback_dirs_psr4 = new_dirs; } else { @@ -196,7 +196,7 @@ impl ClassLoader { } else if prepend { // Prepend directories for an already registered namespace. let existing = self.prefix_dirs_psr4.get_mut(prefix).unwrap(); - let mut new_dirs = paths.clone(); + let mut new_dirs = paths; new_dirs.append(existing); *existing = new_dirs; } else { |
