[#607] *: Remove redundant if on error returns

Semantic patch:
```
@@
@@
-if err != nil { return err }
-return nil
+return err
```

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-08-14 14:06:17 +03:00 committed by Evgenii Stratonikov
parent 5a51b78946
commit a8de37c8a2
7 changed files with 8 additions and 39 deletions

View file

@ -246,11 +246,7 @@ func (s *Server) initAlphabetProcessor(cfg *viper.Viper) error {
} }
err = bindMorphProcessor(s.alphabetProcessor, s) err = bindMorphProcessor(s.alphabetProcessor, s)
if err != nil { return err
return err
}
return nil
} }
func (s *Server) initContainerProcessor(cfg *viper.Viper, cnrClient *container.Client, func (s *Server) initContainerProcessor(cfg *viper.Viper, cnrClient *container.Client,
@ -454,11 +450,7 @@ func (s *Server) initProcessors(cfg *viper.Viper, morphClients *serverMorphClien
} }
err = s.initAlphabetProcessor(cfg) err = s.initAlphabetProcessor(cfg)
if err != nil { return err
return err
}
return nil
} }
func (s *Server) initMorph(ctx context.Context, cfg *viper.Viper, errChan chan<- error) (*chainParams, error) { func (s *Server) initMorph(ctx context.Context, cfg *viper.Viper, errChan chan<- error) (*chainParams, error) {

View file

@ -33,11 +33,7 @@ func (c *Config) Init() error {
} }
c.decoder, err = zstd.NewReader(nil) c.decoder, err = zstd.NewReader(nil)
if err != nil { return err
return err
}
return nil
} }
// NeedsCompression returns true if the object should be compressed. // NeedsCompression returns true if the object should be compressed.

View file

@ -146,10 +146,7 @@ func (t *boltForest) Init() error {
return err return err
} }
_, err = tx.CreateBucketIfNotExists(logBucket) _, err = tx.CreateBucketIfNotExists(logBucket)
if err != nil { return err
return err
}
return nil
}) })
} }
func (t *boltForest) Close() error { func (t *boltForest) Close() error {

View file

@ -101,9 +101,5 @@ func (c *Client) UnsubscribeAll() error {
} }
err := c.client.UnsubscribeAll() err := c.client.UnsubscribeAll()
if err != nil { return err
return err
}
return nil
} }

View file

@ -243,11 +243,7 @@ func (p Preparator) validateParameterOpcodes(ops []Op) error {
} }
err = validateNestedArgs(argsLen, ops[:l-2]) err = validateNestedArgs(argsLen, ops[:l-2])
if err != nil { return err
return err
}
return nil
} }
func validateNestedArgs(expArgLen int64, ops []Op) error { func validateNestedArgs(expArgLen int64, ops []Op) error {

View file

@ -74,11 +74,7 @@ func (n *Writer) Notify(topic string, address oid.Address) error {
} }
_, err := n.js.Publish(topic, []byte(address.EncodeToString()), nats.MsgId(messageID)) _, err := n.js.Publish(topic, []byte(address.EncodeToString()), nats.MsgId(messageID))
if err != nil { return err
return err
}
return nil
} }
// New creates new Writer. // New creates new Writer.

View file

@ -102,11 +102,7 @@ func (s *TokenStore) Get(ownerID user.ID, tokenID []byte) (t *storage.PrivateTok
var err error var err error
t, err = s.unpackToken(rawToken) t, err = s.unpackToken(rawToken)
if err != nil { return err
return err
}
return nil
}) })
if err != nil { if err != nil {
s.l.Error(logs.PersistentCouldNotGetSessionFromPersistentStorage, s.l.Error(logs.PersistentCouldNotGetSessionFromPersistentStorage,