about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-04-24 08:49:49 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2025-04-24 11:12:34 +1000
commit055a27da2afcc8a7d74a551c32e8a831a825d549 (patch)
tree0e167ff7afcba57293c846f18ea79f112db4ed66 /src
parentb8c54d6358926028ac2fab1ec2b8665c70edb1c0 (diff)
downloadrust-055a27da2afcc8a7d74a551c32e8a831a825d549.tar.gz
rust-055a27da2afcc8a7d74a551c32e8a831a825d549.zip
Remove some unnecessary clones.
I found these by grepping for `&[a-z_\.]*\.clone()`, i.e. expressions
like `&a.b.clone()`, which are sometimes unnecessary clones, and also
looking at clones nearby to cases like that.
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/src/core/build_steps/setup.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bootstrap/src/core/build_steps/setup.rs b/src/bootstrap/src/core/build_steps/setup.rs
index 83083e12ef1..9d07babe519 100644
--- a/src/bootstrap/src/core/build_steps/setup.rs
+++ b/src/bootstrap/src/core/build_steps/setup.rs
@@ -683,7 +683,7 @@ impl Step for Editor {
         match EditorKind::prompt_user() {
             Ok(editor_kind) => {
                 if let Some(editor_kind) = editor_kind {
-                    while !t!(create_editor_settings_maybe(config, editor_kind.clone())) {}
+                    while !t!(create_editor_settings_maybe(config, &editor_kind)) {}
                 } else {
                     println!("Ok, skipping editor setup!");
                 }
@@ -695,7 +695,7 @@ impl Step for Editor {
 
 /// Create the recommended editor LSP config file for rustc development, or just print it
 /// If this method should be re-called, it returns `false`.
-fn create_editor_settings_maybe(config: &Config, editor: EditorKind) -> io::Result<bool> {
+fn create_editor_settings_maybe(config: &Config, editor: &EditorKind) -> io::Result<bool> {
     let hashes = editor.hashes();
     let (current_hash, historical_hashes) = hashes.split_last().unwrap();
     let settings_path = editor.settings_path(config);
@@ -752,7 +752,7 @@ fn create_editor_settings_maybe(config: &Config, editor: EditorKind) -> io::Resu
             // exists but user modified, back it up
             Some(false) => {
                 // exists and is not current version or outdated, so back it up
-                let backup = settings_path.clone().with_extension(editor.backup_extension());
+                let backup = settings_path.with_extension(editor.backup_extension());
                 eprintln!(
                     "WARNING: copying `{}` to `{}`",
                     settings_path.file_name().unwrap().to_str().unwrap(),