3 Commits

Author SHA1 Message Date
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
Brian Carbone 5c2b594d0e runtime(rust): Update indentation after nested array literal
fixes:  #18974
closes: #19042

Signed-off-by: Brian Carbone <brian@briancarbone.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-12-31 09:26:20 +00:00
Christian Brabandt ea2b98b9e9 runtime(indent-tests): Include a simple Rust indent test
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-12-28 14:00:44 +00:00