Solution (source code)

= Solution

On the horizontal segment $y=0$, while $x$ decreases from $1$ to $-1$. Keeping this orientation gives
$$
\boxed{\int_C\mathbf F\cdot d\mathbf r=\int_1^{-1}x^2\,dx=-\frac23}.
$$
The minus sign follows from traversing opposite to the positive $x$ direction.