Browse code

daemon/monitor: rm redundant if

The last check for err != nil is not needed as err is always non-nil
there. Remove the check.

Also, no need to explicitly define `var err error` here.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>

Kir Kolyshkin authored on 2019/08/06 08:56:38
Showing 1 changed files
... ...
@@ -202,15 +202,13 @@ func (daemon *Daemon) autoRemove(c *container.Container) {
202 202
 		return
203 203
 	}
204 204
 
205
-	var err error
206
-	if err = daemon.ContainerRm(c.ID, &types.ContainerRmConfig{ForceRemove: true, RemoveVolume: true}); err == nil {
205
+	err := daemon.ContainerRm(c.ID, &types.ContainerRmConfig{ForceRemove: true, RemoveVolume: true})
206
+	if err == nil {
207 207
 		return
208 208
 	}
209 209
 	if c := daemon.containers.Get(c.ID); c == nil {
210 210
 		return
211 211
 	}
212 212
 
213
-	if err != nil {
214
-		logrus.WithError(err).WithField("container", c.ID).Error("error removing container")
215
-	}
213
+	logrus.WithError(err).WithField("container", c.ID).Error("error removing container")
216 214
 }