When is it allowed to substitute the value of a standard limit such as $\lim_{x\rightarrow0} (\sin x)/x=1$ and $\lim_{x\rightarrow0} \ln(1+x)/x=1$ while adding different functions?
For example if we substitute $\lim_{x\to 0} \ln(1+x)=x$ here we get, $\lim_{x\rightarrow0} (x\cos x-\ln(1+x))/x^2=\lim_{x\rightarrow0} (x\cos x-x)/x^2=\lim_{x\rightarrow0} (\cos x-1)/x=0$ However the actual limit evaluated using L'hospitals rule is $1/2$.
Thus it is wrong to replace $\ln(1+x)$ by $x$. Is it ever possible to substitute $\ln(1+x)$ by $x$ while adding functions.