我刚刚把我的锈蚀更新为rustc 1.63.0 (4b91a6ea7 2022-08-08)
在我的.rustfmt.toml文件中
# Basic
hard_tabs = true
max_width = 100
use_small_heuristics = "Max"
# Imports
imports_granularity = "Crate"
reorder_imports = true
# Consistency
newline_style = "Unix"
# Misc
binop_separator = "Back"
chain_width = 80
match_arm_blocks = false
match_arm_leading_pipes = "Preserve"
match_block_trailing_comma = true
reorder_impl_items = false
spaces_around_ranges = false
trailing_comma = "Vertical"
trailing_semicolon = false
use_field_init_shorthand = true通过锈蚀夜间工具链安装锈蚀
rustup toolchain add nightly && rustup component add rustfmt --toolchain nightly我得到了nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.65.0-nightly (015a824f2 2022-08-22)
然后运行rustfmt检查我的代码格式。
cargo +nightly fmt
cargo fmt --check我收到了一大堆警告!
Warning: can't set `imports_granularity = Crate`, unstable features are only available in nightly channel.
Warning: can't set `reorder_impl_items = false`, unstable features are only available in nightly channel.
Warning: can't set `spaces_around_ranges = false`, unstable features are only available in nightly channel.
Warning: can't set `binop_separator = Back`, unstable features are only available in nightly channel.
Warning: can't set `match_arm_blocks = false`, unstable features are only available in nightly channel.
Warning: can't set `trailing_semicolon = false`, unstable features are only available in nightly channel.
Warning: can't set `trailing_comma = Vertical`, unstable features are only available in nightly channel.我该如何解决这些警告呢?我的rustfmt.toml中缺少了什么?
发布于 2022-08-23 10:49:23
对每个cargo fmt调用显式使用夜间工具链:
cargo +nightly fmt --checkhttps://stackoverflow.com/questions/73455965
复制相似问题