San Francisco Giants righty Matt Cain left Thursday's game against the Pittsburgh Pirates with a contusion on his right forearm after he was hit by a line drive.

The injury occurred in the fourth inning when Gaby Sanchez laced a ball that glanced off Cain as he tried to protect himself. Cain walked off the field and was replaced by Guillermo Moscoso. X-rays taken were negative.

A three-time All-Star, Cain entered the game 8-8 with a 4.35 ERA in 25 starts.

Coming into Thursday's game, since the All-Star break, he had allowed two runs or fewer in five of his six starts.