about summary refs log tree commit diff
diff options
context:
space:
mode:
authortempdragon <645703113@qq.com>2024-03-11 12:13:30 +0800
committertempdragon <645703113@qq.com>2024-03-11 12:13:30 +0800
commit8d4d87859b6ec9d5aae2b0297514b27d413c19d2 (patch)
treef46886dabb7563dff714c546abee2a9f1ba0e43e
parentc6b75581d06a573eb8f419d83f4ecbed18c0e805 (diff)
downloadrust-8d4d87859b6ec9d5aae2b0297514b27d413c19d2.tar.gz
rust-8d4d87859b6ec9d5aae2b0297514b27d413c19d2.zip
fix(clippy): Clone-related clippy workarounds
1. Use `clone_from` in place of `clone()` in `builder.rs`
2. Change `&name` to `name.clone()` in `debuginfo.rs`(Is this really
efficient? But I can't find other workarounds.)
-rw-r--r--src/builder.rs2
-rw-r--r--src/debuginfo.rs6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/builder.rs b/src/builder.rs
index 2241e0ea364..ebd6595b438 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -225,7 +225,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
 
         let mut on_stack_param_indices = FxHashSet::default();
         if let Some(indices) = self.on_stack_params.borrow().get(&gcc_func) {
-            on_stack_param_indices = indices.clone();
+            on_stack_param_indices.clone_from(indices);
         }
 
         if all_args_match {
diff --git a/src/debuginfo.rs b/src/debuginfo.rs
index a485225a256..7ca4743f4b8 100644
--- a/src/debuginfo.rs
+++ b/src/debuginfo.rs
@@ -279,9 +279,9 @@ impl<'gcc, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
     ) -> Self::DILocation {
         let pos = span.lo();
         let DebugLoc { file, line, col } = self.lookup_debug_loc(pos);
-        let loc = match &file.name {
-            rustc_span::FileName::Real(ref name) => match &name {
-                rustc_span::RealFileName::LocalPath(ref name) => {
+        let loc = match file.name {
+            rustc_span::FileName::Real(ref name) => match name.clone() {
+                rustc_span::RealFileName::LocalPath(name) => {
                     if let Some(name) = name.to_str() {
                         self.context.new_location(name, line as i32, col as i32)
                     } else {