Skip to content

Remove unused visitor helpers - #809

Merged
hsbt merged 1 commit into
ruby:masterfrom
nvasilevski:rubydex/dead-code
Aug 21, 2026
Merged

Remove unused visitor helpers#809
hsbt merged 1 commit into
ruby:masterfrom
nvasilevski:rubydex/dead-code

Conversation

@nvasilevski

Copy link
Copy Markdown
Contributor

Psych::Visitors::ToRuby#merge_key and Psych::Visitors::YAMLTree#dump_list are empty private methods with no callers.

They are not visitor interface methods: Psych's dispatch paths construct and call only visit_* methods. Other dump_* helpers are called explicitly, while dump_list is not.

The history also shows that both methods have been unused since they were added:

  • merge_key was added empty in 2025502 while the same change implemented merge handling inline in revive_hash.
  • dump_list was added empty in 59ecddb while the same change implemented array dumping inline in visit_array_subclass.

This removes both unreachable methods.

Verification:

  • bundle exec ruby -Itest/lib:test -rhelper test/psych/test_merge_keys.rb — 14 tests, 19 assertions, 0 failures
  • bundle exec ruby -Itest/lib:test -rhelper test/psych/test_array.rb — 10 tests, 20 assertions, 0 failures
  • bundle exec ruby -Itest/lib:test -rhelper test/psych/visitors/test_yaml_tree.rb — 31 tests, 129 assertions, 0 failures

merge_key was added empty in 2025502 while merge handling remained inline in revive_hash, and it has never been called. dump_list was added empty in 59ecddb while array dumping was implemented inline in visit_array_subclass, and it has never been called. Psych visitor dispatch only targets visit_* methods.
@hsbt
hsbt merged commit e61b6fd into ruby:master Aug 21, 2026
97 checks passed
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