style: deduplicate types in function signatures (#2322)

This commit is contained in:
CatsDeservePets authored and GitHub committed 2025-12-27 06:24:15 +01:00
1 parent d8b9026ef2
commit eb01cb7c7b
6 files changed
+11 -11

No files matched your search

+1 -1
View File
@@ -86,7 +86,7 @@ func run() {
} }
} }
func writeLastDir(filename string, lastDir string) { func writeLastDir(filename, lastDir string) {
f, err := os.Create(filename) f, err := os.Create(filename)
if err != nil { if err != nil {
log.Printf("opening last dir file: %s", err) log.Printf("opening last dir file: %s", err)
+1 -1
View File
@@ -239,7 +239,7 @@ func matchCmd(s string) (matches []compMatch, result string) {
return return
} }
func matchFile(s string, dirOnly bool, escape func(string) string, unescape func(string) string) (matches []compMatch, result string) { func matchFile(s string, dirOnly bool, escape, unescape func(string) string) (matches []compMatch, result string) {
dir, file := filepath.Split(unescape(replaceTilde(s))) dir, file := filepath.Split(unescape(replaceTilde(s)))
d := dir d := dir
+1 -1
View File
@@ -30,7 +30,7 @@ func TestRemoveDiacritics(t *testing.T) {
checkRemoveDiacritics(testStr, expStr, t) checkRemoveDiacritics(testStr, expStr, t)
} }
func checkRemoveDiacritics(testStr string, expStr string, t *testing.T) { func checkRemoveDiacritics(testStr, expStr string, t *testing.T) {
resultStr := removeDiacritics(testStr) resultStr := removeDiacritics(testStr)
if resultStr != expStr { if resultStr != expStr {
t.Errorf("at input '%v' expected '%v' but got '%v'", testStr, expStr, resultStr) t.Errorf("at input '%v' expected '%v' but got '%v'", testStr, expStr, resultStr)
+1 -1
View File
@@ -408,7 +408,7 @@ func getFileExtension(file fs.FileInfo) string {
// character will appear (0 means left, 50 means middle, 100 means right). // character will appear (0 means left, 50 means middle, 100 means right).
// The file extension is not affected by truncation, however it will be clipped // The file extension is not affected by truncation, however it will be clipped
// if it exceeds the allowed width. // if it exceeds the allowed width.
func truncateFilename(file fs.FileInfo, maxWidth int, truncatePct int, truncateChar rune) string { func truncateFilename(file fs.FileInfo, maxWidth, truncatePct int, truncateChar rune) string {
filename := file.Name() filename := file.Name()
if runeSliceWidth([]rune(filename)) <= maxWidth { if runeSliceWidth([]rune(filename)) <= maxWidth {
return filename return filename
+1 -1
View File
@@ -1271,7 +1271,7 @@ func (nav *nav) toggle() {
nav.toggleSelection(curr.path) nav.toggleSelection(curr.path)
} }
func (nav *nav) tagToggleSelection(path string, tag string) { func (nav *nav) tagToggleSelection(path, tag string) {
if _, ok := nav.tags[path]; ok { if _, ok := nav.tags[path]; ok {
delete(nav.tags, path) delete(nav.tags, path)
} else { } else {
+6 -6
View File
@@ -277,7 +277,7 @@ func infotimefmt(t time.Time) string {
return t.Format(gOpts.infotimefmtold) return t.Format(gOpts.infotimefmtold)
} }
func fileInfo(f *file, d *dir, userWidth int, groupWidth int, customWidth int) (string, string, int) { func fileInfo(f *file, d *dir, userWidth, groupWidth, customWidth int) (string, string, int) {
var info strings.Builder var info strings.Builder
var custom string var custom string
var off int var off int
@@ -549,7 +549,7 @@ func (win *win) printDir(ui *ui, dir *dir, context *dirContext, dirStyle *dirSty
} }
} }
func getUserWidth(dir *dir, beg int, end int) int { func getUserWidth(dir *dir, beg, end int) int {
maxw := 0 maxw := 0
for _, f := range dir.files[beg:end] { for _, f := range dir.files[beg:end] {
@@ -559,7 +559,7 @@ func getUserWidth(dir *dir, beg int, end int) int {
return maxw return maxw
} }
func getGroupWidth(dir *dir, beg int, end int) int { func getGroupWidth(dir *dir, beg, end int) int {
maxw := 0 maxw := 0
for _, f := range dir.files[beg:end] { for _, f := range dir.files[beg:end] {
@@ -569,7 +569,7 @@ func getGroupWidth(dir *dir, beg int, end int) int {
return maxw return maxw
} }
func getCustomWidth(dir *dir, beg int, end int) int { func getCustomWidth(dir *dir, beg, end int) int {
maxw := 0 maxw := 0
for _, f := range dir.files[beg:end] { for _, f := range dir.files[beg:end] {
@@ -835,7 +835,7 @@ func (ui *ui) drawPromptLine(nav *nav) {
ui.promptWin.print(ui.screen, 0, 0, st, prompt) ui.promptWin.print(ui.screen, 0, 0, st, prompt)
} }
func formatRulerOpt(name string, val string) string { func formatRulerOpt(name, val string) string {
// handle escape character so it doesn't mess up the ruler // handle escape character so it doesn't mess up the ruler
val = strings.ReplaceAll(val, "\033", "\033[7m\\033\033[0m") val = strings.ReplaceAll(val, "\033", "\033[7m\\033\033[0m")
@@ -865,7 +865,7 @@ func (ui *ui) drawStat(nav *nav) {
} }
statfmt := strings.ReplaceAll(gOpts.statfmt, "|", "\x1f") statfmt := strings.ReplaceAll(gOpts.statfmt, "|", "\x1f")
replace := func(s string, val string) { replace := func(s, val string) {
if val == "" { if val == "" {
val = "\x00" val = "\x00"
} }