Skip to content

Remove unused visitor helpers#809

Open
nvasilevski wants to merge 1 commit into
ruby:masterfrom
nvasilevski:rubydex/dead-code
Open

Remove unused visitor helpers#809
nvasilevski wants to merge 1 commit into
ruby:masterfrom
nvasilevski:rubydex/dead-code

Conversation

@nvasilevski

Copy link
Copy Markdown

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.
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.

1 participant