From eb01cb7c7b06c0b4e501d9328287a7720ea523ae Mon Sep 17 00:00:00 2001 From: CatsDeservePets <145048791+CatsDeservePets@users.noreply.github.com> Date: Sat, 27 Dec 2025 06:24:15 +0100 Subject: [PATCH] style: deduplicate types in function signatures (#2322) --- client.go | 2 +- complete.go | 2 +- diacritics_test.go | 2 +- misc.go | 2 +- nav.go | 2 +- ui.go | 12 ++++++------ 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/client.go b/client.go index 730c5fe8..1a0d8cee 100644 --- a/client.go +++ b/client.go @@ -86,7 +86,7 @@ func run() { } } -func writeLastDir(filename string, lastDir string) { +func writeLastDir(filename, lastDir string) { f, err := os.Create(filename) if err != nil { log.Printf("opening last dir file: %s", err) diff --git a/complete.go b/complete.go index 7e0fe2db..5c621971 100644 --- a/complete.go +++ b/complete.go @@ -239,7 +239,7 @@ func matchCmd(s string) (matches []compMatch, result string) { 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))) d := dir diff --git a/diacritics_test.go b/diacritics_test.go index 13a298d5..66e4b37c 100644 --- a/diacritics_test.go +++ b/diacritics_test.go @@ -30,7 +30,7 @@ func TestRemoveDiacritics(t *testing.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) if resultStr != expStr { t.Errorf("at input '%v' expected '%v' but got '%v'", testStr, expStr, resultStr) diff --git a/misc.go b/misc.go index 32fcd321..cc5fa470 100644 --- a/misc.go +++ b/misc.go @@ -408,7 +408,7 @@ func getFileExtension(file fs.FileInfo) string { // 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 // 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() if runeSliceWidth([]rune(filename)) <= maxWidth { return filename diff --git a/nav.go b/nav.go index 8131f502..cb09464d 100644 --- a/nav.go +++ b/nav.go @@ -1271,7 +1271,7 @@ func (nav *nav) toggle() { 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 { delete(nav.tags, path) } else { diff --git a/ui.go b/ui.go index 54ed2c29..c4989490 100644 --- a/ui.go +++ b/ui.go @@ -277,7 +277,7 @@ func infotimefmt(t time.Time) string { 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 custom string 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 for _, f := range dir.files[beg:end] { @@ -559,7 +559,7 @@ func getUserWidth(dir *dir, beg int, end int) int { return maxw } -func getGroupWidth(dir *dir, beg int, end int) int { +func getGroupWidth(dir *dir, beg, end int) int { maxw := 0 for _, f := range dir.files[beg:end] { @@ -569,7 +569,7 @@ func getGroupWidth(dir *dir, beg int, end int) int { return maxw } -func getCustomWidth(dir *dir, beg int, end int) int { +func getCustomWidth(dir *dir, beg, end int) int { maxw := 0 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) } -func formatRulerOpt(name string, val string) string { +func formatRulerOpt(name, val string) string { // handle escape character so it doesn't mess up the ruler 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") - replace := func(s string, val string) { + replace := func(s, val string) { if val == "" { val = "\x00" }