#7119·rustfmt

嵌套的调用链具有奇怪的格式

作者: Xyndra创建于 2026年9月13日更新于 2026年9月22日
标签C-bugI-poor-formattingA-call-chains
rust
/// 返回 n_1, b_1, n_2, b_2
fn distribute(sum: u64) -> (u64, u64, u64, u64) {
    let mut a = sum;
    // ...
    if a == 1 {
        // ...
    } else {
        let kmax: u64 = a.ilog2().into();
        let pow_2_kmax: u64 = (2_i32
            .pow(kmax.try_into().expect("k_max could not convert into u32")))
            .try_into()
            .expect("2^(k_max) could not convert to u64");
        return (kmax + 1 + m, 1, a - pow_2_kmax + 1 + m, a - pow_2_kmax);
    }
}

内容来源: rust-lang/rustfmt