Get rid of warnings from rspec-core's library and spec code.

Extension of #907 with some refactorings