mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
refactor: replace strings.Replace with strings.ReplaceAll
strings.ReplaceAll(s, old, new) is a wrapper function for strings.Replace(s, old, new, -1). But strings.ReplaceAll is more readable and removes the hardcoded -1. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
committed by
Nick Craig-Wood
parent
b929a56f46
commit
4f0ddb60e7
@@ -44,7 +44,7 @@ type RegInfo struct {
|
||||
|
||||
// FileName returns the on disk file name for this backend
|
||||
func (ri *RegInfo) FileName() string {
|
||||
return strings.Replace(ri.Name, " ", "", -1)
|
||||
return strings.ReplaceAll(ri.Name, " ", "")
|
||||
}
|
||||
|
||||
// Options is a slice of configuration Option for a backend
|
||||
@@ -210,7 +210,7 @@ func (o *Option) Type() string {
|
||||
|
||||
// FlagName for the option
|
||||
func (o *Option) FlagName(prefix string) string {
|
||||
name := strings.Replace(o.Name, "_", "-", -1) // convert snake_case to kebab-case
|
||||
name := strings.ReplaceAll(o.Name, "_", "-") // convert snake_case to kebab-case
|
||||
if !o.NoPrefix {
|
||||
name = prefix + "-" + name
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user