In the book of The theory of Functions by Titchmarsh, at page 78, after Cauchy's integral theorem, it is given that
Suppose again that $C$ is a simple closed contour, and $C'$ another simple closed contour lying entirely inside $C$. Let $f(z)$ be analytic and one-valued at all points in the ring-shaped region between $C$ and $C'$. Then $\int_C f(z) = \int_{C'} f(z).$ For we can join $C$ to $C'$ by a straight line $l$ parallel, say, to the real axis.Then the region between $C$ and $C'$, cut by $l$, is the inside of the contour $\Gamma$, formed by $C$ described positively, $C'$ negatively, and $l$ described twice in opposite directions.
However, even though, we are traversing on $l$ in opposite directions, the line segments that we are passing on are different. I mean if we traverse $l$ in the positive direction while going from the beginning of $C$ (choose one end as the beginnings) to $C'$, and traversing negatively while going from the end of $C'$ to $C$. Therefore, even even though we pass on $l$ twice, we travel on different parts of $l$, so how can we directly claim that these both integrals, i.e $\int_l f(z)$, cancel each other ?
Edit:
So, for example, we start from $A$, go along $l$, then traverse $C'$ from $C$ to $D$, and then pass along $l$ again in the same direction, and traverse $C$ from $B$ to $A$.

Let $\gamma\colon[0,1]\longrightarrow\mathbb C$ be any path. The integral pf $f$ along $\gamma$ is$$\int_\gamma f(z)\,\mathrm dz=\int_0^1f\bigl(\gamma(t)\bigr)\gamma'(t)\,\mathrm dt.$$The opposite path of $\gamma$ is $\gamma^-$ define by $\gamma^-(t)(\gamma(1-t)$.Add\begin{align}\int_{\gamma^-}f(z)\,\mathrm dz&=\int_0^1f\bigl(\gamma^-(t)\bigr){\gamma^-}'(t)\,\mathrm dt\\&=-\int_0^1f\bigl(\gamma(1-t)\bigr)\gamma'(1-t)\,\mathrm dt\\&=\int_1^0f\bigl(\gamma(t)\bigr)\gamma'(t)\,\mathrm dt\\&=-\int_\gamma f(z)\,\mathrm dz.\end{align}