From 319087c05664842ff4282b7dfeee14860ea7434c Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Thu, 18 May 2023 18:07:19 +0200 Subject: [PATCH] Remove redundant if ...; err != nil; return pattern --- cmd/restic/main.go | 6 +----- internal/backend/b2/b2.go | 5 +---- internal/restic/node.go | 6 +----- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/cmd/restic/main.go b/cmd/restic/main.go index cfef7c885..392177d13 100644 --- a/cmd/restic/main.go +++ b/cmd/restic/main.go @@ -63,11 +63,7 @@ directories in an encrypted repository stored on different backends. // run the debug functions for all subcommands (if build tag "debug" is // enabled) - if err := runDebug(); err != nil { - return err - } - - return nil + return runDebug() }, } diff --git a/internal/backend/b2/b2.go b/internal/backend/b2/b2.go index 738df198d..7f4dba831 100644 --- a/internal/backend/b2/b2.go +++ b/internal/backend/b2/b2.go @@ -306,10 +306,7 @@ func (be *b2Backend) List(ctx context.Context, t restic.FileType, fn func(restic return err } } - if err := iter.Err(); err != nil { - return err - } - return nil + return iter.Err() } // Delete removes all restic keys in the bucket. It will not remove the bucket itself. diff --git a/internal/restic/node.go b/internal/restic/node.go index a1aff18ac..7d2a1434e 100644 --- a/internal/restic/node.go +++ b/internal/restic/node.go @@ -605,11 +605,7 @@ func (node *Node) fillExtra(path string, fi os.FileInfo) error { return errors.Errorf("invalid node type %q", node.Type) } - if err := node.fillExtendedAttributes(path); err != nil { - return err - } - - return nil + return node.fillExtendedAttributes(path) } func (node *Node) fillExtendedAttributes(path string) error {