upgrade: Use `improvement` subclasses everywhere, not instances

Authored by SimonSapin.


upgrade: Use improvement subclasses everywhere, not instances

This changes the source definition of optimizations to match that of formats:
a subclass with a decorator, instead of an instance passed to a function call.
Not having any instance removes the confusion between class attributes and
instance attributes, which were used interchangeably.

Differential Revision: https://phab.mercurial-scm.org/D10768