diff options
| author | Gaëtan Cassiers <gaetan.cassiers@gmail.com> | 2015-05-24 23:35:40 +0200 |
|---|---|---|
| committer | Gaëtan Cassiers <gaetan.cassiers@gmail.com> | 2015-05-24 23:35:40 +0200 |
| commit | c1fc693c5e5676f93a331a0498dc6ba36193cd66 (patch) | |
| tree | 25eda44bab57a842cb49e64e24d48b5c9d30f761 /src | |
| parent | 1db6fa0fe5d8ea9ddef2d5610c2485d9ec3a3cc5 (diff) | |
syle correction
Diffstat (limited to 'src')
| -rw-r--r-- | src/expr.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/expr.rs b/src/expr.rs index 66a79a3a777..c242322a51d 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -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)) } } |
