New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unnecessarily deep indent on arguments following some paren-heavy code #1306
Comments
Also happens here: fn write_content() {
io::copy(try!(File::open(in_f).map_err(|_| {
Error::Io {
desc: "Content",
op: "open",
more: None,
}
})),
w);
} |
You could consider using fn foo() {
for elem in try!(gen_epub_book::ops::parse_descriptor_file(
&mut try!(File::open(&opts.source_file.1).map_err(|_| {
gen_epub_book::Error::Io {
desc: "input file",
op: "open",
more: None,
}
})),
"input file"
)) {
println!("{}", elem);
}
}
fn write_content() {
io::copy(
try!(File::open(in_f).map_err(|_| {
Error::Io {
desc: "Content",
op: "open",
more: None,
}
})),
w,
);
} |
That's ugly though |
This no longer applies. |
@kadiwa4 thanks for looking into this. I can confirm that when I use the default rustfmt configs I can't reproduce this issue. Here are the configs orginally listed: max_width = 160
ideal_width = 128
fn_call_width = 96
fn_args_paren_newline = false
fn_args_density = "Compressed"
struct_trailing_comma = "Always"
wrap_comments = true Not all of them exist anymore. I don't think we have substitutes for max_width = 160
fn_call_width = 96
fn_args_layout = "Compressed"
trailing_comma = "Always"
wrap_comments = true given this input: fn foo() {
for elem in try!(gen_epub_book::ops::parse_descriptor_file(&mut try!(File::open(&opts.source_file.1).map_err(|_| {
gen_epub_book::Error::Io {
desc: "input file",
op: "open",
more: None,
}
})),
"input file")) {
println!("{}", elem);
}
}
fn write_content() {
io::copy(try!(File::open(in_f).map_err(|_| {
Error::Io {
desc: "Content",
op: "open",
more: None,
}
})),
w);
} fn foo() {
for elem in try!(gen_epub_book::ops::parse_descriptor_file(
&mut try!(File::open(&opts.source_file.1).map_err(|_| {
gen_epub_book::Error::Io {
desc: "input file",
op: "open",
more: None,
}
})),
"input file"
)) {
println!("{}", elem);
}
}
fn write_content() {
io::copy(
try!(File::open(in_f).map_err(|_| {
Error::Io {
desc: "Content",
op: "open",
more: None,
}
})),
w,
);
} |
Given this config,
rustfmt
insists, that this is the best way to format this code chunk:When I'd expect it to do something like this:
The text was updated successfully, but these errors were encountered: