Increase the max width by tab width when using format_code_block

since the macro body will be surrounded by fn main block.
This commit is contained in:
Seiichi Uchida 2018-08-16 07:47:37 +09:00
parent 9a5a86164f
commit b318e5a684

View File

@ -1285,10 +1285,14 @@ impl MacroBranch {
// First try to format as items, then as statements.
let new_body = match ::format_snippet(&body_str, &config) {
Some(new_body) => new_body,
None => match ::format_code_block(&body_str, &config) {
Some(new_body) => new_body,
None => return None,
},
None => {
let new_width = new_width + config.tab_spaces();
config.set().max_width(new_width);
match ::format_code_block(&body_str, &config) {
Some(new_body) => new_body,
None => return None,
}
}
};
let new_body = wrap_str(new_body, config.max_width(), shape)?;