小编Avi*_*Avi的帖子

如何将 rustfmt 配置为发出制表符而不是这些缩进空格?

为什么 rustfmt 在下面的代码示例中发出缩进空格,以及如何将其配置为停止?

我有以下代码:

fn main() {
    if {
        let to_comp = true;
        if to_comp { true } else { false }
    } {
        println!("true");
    }
}
Run Code Online (Sandbox Code Playgroud)

rustfmt 格式为(我已替换所有制表符--->和缩进空格以_说明缩进):

fn main() {
--->if {
--->--->___let to_comp = true;
--->--->___if to_comp { true } else { false }
--->--->__} {
--->--->println!("true");
--->}
}
Run Code Online (Sandbox Code Playgroud)

rustfmt.toml的上述代码:

tab_spaces = 4
hard_tabs = true
array_layout = "Block"
reorder_imports = true
newline_style = "Unix"
spaces_within_angle_brackets = false
spaces_within_parens …
Run Code Online (Sandbox Code Playgroud)

rust

5
推荐指数
1
解决办法
4504
查看次数

标签 统计

rust ×1