[vim/vim] Fix Rust indentation when a string literal contains "if" (PR #19265)

0 views
Skip to first unread message

taylor.fish

unread,
Jan 27, 2026, 10:40:59 PM (8 hours ago) Jan 27
to vim/vim, Subscribed

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).


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/19265

Commit Summary

  • a350cd2 Fix Rust indentation when string contains "if"

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19265@github.com>

Reply all
Reply to author
Forward
0 new messages