Removing `underfull \hbox` warning with \hbox: how to do it

boxeswarnings

How can I remove the warning

Underfull \hbox (badness 10000) detected at line 4 \OT1/cmr/m/n/10
test

in the following MWE ?

\documentclass{article}
\begin{document}
\leavevmode\hbox to3cm{test}Hello
\end{document}

Best Answer

The latex syntax for this adds the glue to stop the underful message (and \leavevmode)

\documentclass{article}
\begin{document}
\makebox[3cm][l]{test}Hello
\end{document}