The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/8047

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Use a single append to concatenate two slices

Signed-off-by: Tim Rots <tim.r...@protonmail.ch>
From 22b08974776a5d2135215bdd66286e7ccb42ba56 Mon Sep 17 00:00:00 2001
From: Tim Rots <tim.r...@protonmail.ch>
Date: Fri, 16 Oct 2020 19:08:35 +0200
Subject: [PATCH] revert/revert.go: remove a for-loop from Clone()

Use a single append to concatenate two slices

Signed-off-by: Tim Rots <tim.r...@protonmail.ch>
---
 lxd/revert/revert.go | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lxd/revert/revert.go b/lxd/revert/revert.go
index dbe65b7edf..4b8642a55d 100644
--- a/lxd/revert/revert.go
+++ b/lxd/revert/revert.go
@@ -38,10 +38,7 @@ func (r *Reverter) Success() {
 func (r *Reverter) Clone() *Reverter {
        rNew := New()
        rNew.revertFuncs = make([]func(), 0, len(r.revertFuncs))
-
-       for _, f := range r.revertFuncs {
-               rNew.revertFuncs = append(rNew.revertFuncs, f)
-       }
+       rNew.revertFuncs = append(rNew.revertFuncs, r.revertFuncs...)
 
        return rNew
 }
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to