我的rustfmt
配置目前将以下代码格式化为具有对齐空格,如下所示。我在以下代码中使用.
和--->
标签替换了空格。
fn main() {
--->match unsafe {
--->--->......0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1
--->--->.....} {
--->--->0 => println!("0"),
--->--->_ => println!("not 0 or 1"),
--->}
}
我的rustfmt
配置(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 = false
spaces_within_square_brackets = false
fn_args_layout = "Block"
fn_call_style = "Block"
fn_return_indent = "WithArgs"
fn_brace_style = "SameLineWhere"
generics_indent= "Block"
item_brace_style = "PreferSameLine"
control_style = "Rfc"
match_style = "Rfc"
unsafe_style = "Rfc"
where_layout = "Horizontal"
where_pred_indent = "Block"
where_style = "Rfc"
如何将rustfmt
配置为不为先前代码发出对齐空格(标记为:.
),因此rustfmt
仅使用以下代码的标签进行缩进?
fn main() {
--->match unsafe {
--->--->0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1
--->--->} {
--->--->0 => println!("0"),
--->--->_ => println!("not 0 or 1"),
--->}
}