syle correction

This commit is contained in:
Gaëtan Cassiers 2015-05-24 23:35:40 +02:00
parent 1db6fa0fe5
commit c1fc693c5e

View File

@ -132,11 +132,14 @@ impl<'a> FmtVisitor<'a> {
debug!("rewrite_paren, subexpr_str: `{}`", subexpr_str);
let mut lines = subexpr_str.rsplit('\n');
let last_line_len = lines.next().unwrap().len();
let last_line_offset = if lines.next().is_none() {offset+1} else {0};
let last_line_offset = match lines.next() {
None => offset+1,
Some(_) => 0,
};
if width + offset - last_line_offset - last_line_len > 0 {
format!("({})", subexpr_str)
} else {
// FIXME That's correct unless we have width < 2. Return an Optrion for such cases ?
// FIXME That's correct unless we have width < 2. Return an Option for such cases ?
format!("({}\n{} )", subexpr_str, make_indent(offset))
}
}