mirror of
https://github.com/v2fly/v2ray-core
synced 2024-02-27 03:18:06 +00:00
Some code improvements
* Rewrite empty string checks more idiomatically. * Change strings.ToLower comparisons to strings.EqualFold. * Rewrite switch statement with only one case as if.
This commit is contained in:
@@ -68,7 +68,7 @@ func (m *Manager) GetHandler(ctx context.Context, tag string) (inbound.Handler,
|
||||
|
||||
// RemoveHandler implements inbound.Manager.
|
||||
func (m *Manager) RemoveHandler(ctx context.Context, tag string) error {
|
||||
if len(tag) == 0 {
|
||||
if tag == "" {
|
||||
return common.ErrNoClue
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ func (m *Manager) AddHandler(ctx context.Context, handler outbound.Handler) erro
|
||||
|
||||
// RemoveHandler implements outbound.Manager.
|
||||
func (m *Manager) RemoveHandler(ctx context.Context, tag string) error {
|
||||
if len(tag) == 0 {
|
||||
if tag == "" {
|
||||
return common.ErrNoClue
|
||||
}
|
||||
m.access.Lock()
|
||||
|
||||
Reference in New Issue
Block a user