private void trimSpaces() {
            if (!trimTrailingSpaces) {
                return;
            }

            StringBuilder buffer = getBuilder();
            int toRemove = 0;
            for (int i = buffer.length() - 1; i > 0; i--) {
                if (buffer.charAt(i) == ' ') {
                    toRemove++;
                } else {
                    break;
                }
            }

            if (toRemove > 0) {
                buffer.delete(buffer.length() - toRemove, buffer.length());
            }
        }
Inline states are created when formatting text. They aren't written
directly to the AbstractCodeWriter, but rather captured as part of the
process of expanding a template argument.
smithy-utils/src/main/java/software/amazon/smithy/utils/AbstractCodeWriter.java