# 对于不想让rustfmt弄坏的东西,使用#[rustfmt::skip] # 要防止rustfmt格式化宏或属性,请使用#[rustfmt::skip::macros(target_macro_name)]或#[rustfmt::skip::attributes(target_attribute_name)],但目前尚未稳定 # 使用rustfmt --print-config default rustfmt.toml生成一个包含默认配置的文件,并根据需要进行自定义 # rustfmt配置官方文档:https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#struct_lit_single_line # rustfmt配置简单中文释义https://blog.csdn.net/qq_45090256/article/details/125476170 # 指定parser版本 edition = "2021" # 每行的最大宽度 max_width = 128 # 设置各种宽度,包括 fn_call_width, attr_fn_like_width, struct_lit_width, struct_variant_width, array_width, chain_width, single_line_if_else_max_width use_small_heuristics = "Max" #表示使用max_width设置的宽度 # 触发数组换行的宽度 array_width = 100 # 一条链式语句最大适应宽度 chain_width = 100 # 注释的最大宽度,只有在 wrap_comments为true时才有效,目前尚不稳定先注释掉 #comment_width = 128 # 函数参数展开样式 fn_args_layout = "Compressed" # 函数调用的最大宽度,注释掉会默认使用use_small_heuristics #fn_call_width = 60 # 跳过格式化的文件,例如ignore = ["src/lib.rs"],目前尚不稳定先注释掉 #ignore = [] # 换行符 newline_style = "Unix" # 使用tab缩进,空格对齐 hard_tabs = true # tab所占空格大小,默认就是4所以注释掉 #tab_spaces = 4 # 当类似于struct、slices、arrays、和blocks/array-like的东西作为最后一个参数时,允许溢出而不是换行缩进,目前尚不稳定先注释掉 #overflow_delimited_expr = true