I haven't found a self-contained example of this yet, but this commit demonstrates the problem: rustfmt changes
if let Ok(name) = str::from_utf8(name) && is_dyn_sym(name) {
let ptr = this.fn_ptr(FnVal::Other(DynSym::from_str(name)));
this.write_pointer(ptr, dest)?;
} else {
this.write_null(dest)?;
}
to
if let Ok(name) = str::from_utf8(name)
&& is_dyn_sym(name)
{
let ptr = this.fn_ptr(FnVal::Other(DynSym::from_str(name)));
this.write_pointer(ptr, dest)?;
} else {
this.write_null(dest)?;
}
Which looks worse due to splitting the if over multiple lines, and which looks like a bug since in the original code, this line was actually shorter than the next one, so it is clearly below the threshold for breaking long lines. I've never seen normal if behave like that, so it's probably something specific to if let, maybe specific to let_chains even.
This is a recent regression, until recently rustfmt didn't change our formatting here.
I haven't found a self-contained example of this yet, but this commit demonstrates the problem: rustfmt changes
to
Which looks worse due to splitting the
ifover multiple lines, and which looks like a bug since in the original code, this line was actually shorter than the next one, so it is clearly below the threshold for breaking long lines. I've never seen normalifbehave like that, so it's probably something specific toif let, maybe specific tolet_chainseven.This is a recent regression, until recently rustfmt didn't change our formatting here.