Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused internal or unexported functions #3481

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexandear
Copy link
Contributor

This PR removes unused internal or unexported functions reported by the deadcode analyzer.

Details
❯ deadcode ./...
internal/action/infocomplete.go:138:6: unreachable func: contains
internal/buffer/line_array.go:289:22: unreachable func: LineArray.deleteByte
internal/config/plugin.go:148:6: unreachable func: FindAnyPlugin
internal/config/rtfiles.go:102:21: unreachable func: namedFile.Name
internal/screen/screen.go:240:6: unreachable func: InitSimScreen
internal/util/profile.go:19:6: unreachable func: Tic
internal/util/profile.go:24:6: unreachable func: Toc
internal/util/util.go:238:6: unreachable func: IsUpperWordChar
internal/util/util.go:244:6: unreachable func: IsLowerWordChar
internal/util/util.go:514:6: unreachable func: ParseSpecial
pkg/highlight/highlighter.go:54:6: unreachable func: combineLineMatch
pkg/highlight/parser.go:268:6: unreachable func: HasIncludes
pkg/highlight/parser.go:276:6: unreachable func: hasIncludesInRegion
pkg/highlight/unicode.go:39:6: unreachable func: DecodeCharacterInString
pkg/highlight/unicode.go:75:6: unreachable func: CharacterCountInString

@alexandear alexandear changed the title Remove unused internal functions Remove unused internal or unexported functions Sep 23, 2024
func Toc(start time.Time) {
end := time.Now()
log.Println("END: ElapsedTime in seconds:", end.Sub(start))
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These may be actually occasionally useful for profiling?

BTW I didn't even know about the existence of this internal/util/profile.go until now (and I find it rather nice). (And BTW also I didn't know about the existence of the memusage command.)

@@ -99,10 +99,6 @@ func (af assetFile) Data() ([]byte, error) {
return rt.Asset(string(af))
}

func (nf namedFile) Name() string {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The namedFile type itself is not used either, so it should be also removed?

// Lower word characters are defined as numbers, lower-case letters or sub-word delimiters
func IsLowerWordChar(r rune) bool {
return IsLowerAlphanumeric(r) || IsSubwordDelimiter(r)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were added not so long ago in #2665. @masmu do you remember why exactly did you add them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants