]> git.lizzy.rs Git - rust.git/commit
Auto merge of #5134 - flip1995:snippet_block, r=phansch
authorbors <bors@rust-lang.org>
Thu, 6 Feb 2020 21:41:50 +0000 (21:41 +0000)
committerbors <bors@rust-lang.org>
Thu, 6 Feb 2020 21:41:50 +0000 (21:41 +0000)
commitb5e6d6db417a88f67e94b63463940c21bc37120b
tree87ebcb0f8d59c8a2c75ccf817ca01699de05fd52
parentee842df61df91f3ed3e33a23f8393c47d384ef40
parente23881e1310f7fe02aeeecf3510a80cbac5aa808
Auto merge of #5134 - flip1995:snippet_block, r=phansch

Make it possible to correctly indent snippet_block snippets

This adds a `indent_relative_to` arg to the `{snippet,expr}_block` functions. This makes it possible to keep the correct indentation of block like suggestions.

In addition, this makes the `trim_multiline` function private and adds a `indent_of` function, to get the indentation of the first line of a span.

The suggestion of `needless_continue` cannot be made auto applicable, since it would be also necessary to remove code following the linted expression. (Well, maybe it is possible, but I don't know how to do it. Expanding the suggestion span to the last expression, that should be removed didn't work)

changelog: Improve suggestions, when blocks of code are involved