That's a fuel line, get it replaced asap. Be careful when buying the hose, as most motorfactor hose is not capable of handling the fuel pressure that an Impreza can generate ( up to 8 Bar ).
I imagine it's a fuel damper of some discription ( dampen's the pulse's from the pump), athough I never really though about it. I will have a closer look the next time I have a Leggy in the workshop.