class RuboCop::Cop::Lint::UselessRescue

def use_exception_variable_in_ensure?(resbody_node)

def use_exception_variable_in_ensure?(resbody_node)
  return false unless (exception_variable = resbody_node.exception_variable)
  return false unless (ensure_node = resbody_node.each_ancestor(:ensure).first)
  return false unless (ensure_body = ensure_node.branch)
  ensure_body.each_descendant(:lvar).map(&:source).include?(exception_variable.source)
end