Files
vim-mirror/runtime
taylor.fish 663d809194 runtime(rust): Fix Rust indentation when string contains "if"
indent/rust.vim behaves incorrectly when a string literal contains the
substring "if".

For example, in this code:

    let x = "
                motif
    ";
    struct X {
                }

indent/rust.vim thinks that the closing "}" should line up with "motif".

This patch fixes the issue by checking whether the "if" is in a string
literal or comment before considering it to be a match for a subsequent
brace (and also by requiring it to start on a word boundary).

Add an indent test to ensure this does not regress.

closes: #19265

Signed-off-by: taylor.fish <contact@taylor.fish>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2026-01-28 22:07:16 +00:00
..