Skip to content

Commit f2bcee9

Browse files
committed
Tidy up some overrunning lines
1 parent 9ab1587 commit f2bcee9

File tree

4 files changed

+25
-12
lines changed

4 files changed

+25
-12
lines changed

src/expr.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,9 @@ fn rewrite_binary_op(context: &RewriteContext,
315315

316316
// 1 = space between lhs expr and operator
317317
let mut result =
318-
try_opt!(lhs.rewrite(context, context.config.max_width - offset - 1 - operator_str.len(), offset));
318+
try_opt!(lhs.rewrite(context,
319+
context.config.max_width - offset - 1 - operator_str.len(),
320+
offset));
319321

320322
result.push(' ');
321323
result.push_str(&operator_str);

src/items.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,9 @@ impl<'a> FmtVisitor<'a> {
467467

468468
// Make sure we do not exceed column limit
469469
// 4 = " = ,"
470-
assert!(self.config.max_width >= vis.len() + name.len() + expr_snippet.len() + 4,
471-
"Enum variant exceeded column limit");
470+
assert!(
471+
self.config.max_width >= vis.len() + name.len() + expr_snippet.len() + 4,
472+
"Enum variant exceeded column limit");
472473
}
473474

474475
result
@@ -768,7 +769,8 @@ impl<'a> FmtVisitor<'a> {
768769
}
769770
}
770771

771-
// TODO we farm this out, but this could spill over the column limit, so we ought to handle it properly
772+
// TODO we farm this out, but this could spill over the column limit, so we
773+
// ought to handle it properly.
772774
fn rewrite_fn_input(&self, arg: &ast::Arg) -> String {
773775
format!("{}: {}",
774776
pprust::pat_to_string(&arg.pat),

src/types.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,26 @@ impl<'a> FmtVisitor<'a> {
2525
..}) => {
2626
if bound_lifetimes.len() > 0 {
2727
format!("for<{}> {}: {}",
28-
bound_lifetimes.iter().map(|l| self.rewrite_lifetime_def(l)).collect::<Vec<_>>().connect(", "),
28+
bound_lifetimes.iter().map(|l| self.rewrite_lifetime_def(l))
29+
.collect::<Vec<_>>().connect(", "),
2930
pprust::ty_to_string(bounded_ty),
30-
bounds.iter().map(|b| self.rewrite_ty_bound(b)).collect::<Vec<_>>().connect(" + "))
31+
bounds.iter().map(|b| self.rewrite_ty_bound(b))
32+
.collect::<Vec<_>>().connect(" + "))
3133

3234
} else {
3335
format!("{}: {}",
3436
pprust::ty_to_string(bounded_ty),
35-
bounds.iter().map(|b| self.rewrite_ty_bound(b)).collect::<Vec<_>>().connect(" + "))
37+
bounds.iter().map(|b| self.rewrite_ty_bound(b))
38+
.collect::<Vec<_>>().connect(" + "))
3639
}
3740
}
3841
&ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate{ref lifetime,
3942
ref bounds,
4043
..}) => {
4144
format!("{}: {}",
4245
pprust::lifetime_to_string(lifetime),
43-
bounds.iter().map(|l| pprust::lifetime_to_string(l)).collect::<Vec<_>>().connect(" + "))
46+
bounds.iter().map(|l| pprust::lifetime_to_string(l))
47+
.collect::<Vec<_>>().connect(" + "))
4448
}
4549
&ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{ref path, ref ty, ..}) => {
4650
format!("{} = {}", pprust::path_to_string(path), pprust::ty_to_string(ty))
@@ -55,7 +59,8 @@ impl<'a> FmtVisitor<'a> {
5559

5660
format!("{}: {}",
5761
pprust::lifetime_to_string(&lifetime.lifetime),
58-
lifetime.bounds.iter().map(|l| pprust::lifetime_to_string(l)).collect::<Vec<_>>().connect(" + "))
62+
lifetime.bounds.iter().map(|l| pprust::lifetime_to_string(l))
63+
.collect::<Vec<_>>().connect(" + "))
5964
}
6065

6166
pub fn rewrite_ty_bound(&self, bound: &ast::TyParamBound) -> String {
@@ -77,7 +82,8 @@ impl<'a> FmtVisitor<'a> {
7782
result.push_str(&token::get_ident(ty_param.ident));
7883
if ty_param.bounds.len() > 0 {
7984
result.push_str(": ");
80-
result.push_str(&ty_param.bounds.iter().map(|b| self.rewrite_ty_bound(b)).collect::<Vec<_>>().connect(" + "));
85+
result.push_str(&ty_param.bounds.iter().map(|b| self.rewrite_ty_bound(b))
86+
.collect::<Vec<_>>().connect(" + "));
8187
}
8288
if let Some(ref def) = ty_param.default {
8389
result.push_str(" = ");
@@ -90,7 +96,8 @@ impl<'a> FmtVisitor<'a> {
9096
fn rewrite_poly_trait_ref(&self, t: &ast::PolyTraitRef) -> String {
9197
if t.bound_lifetimes.len() > 0 {
9298
format!("for<{}> {}",
93-
t.bound_lifetimes.iter().map(|l| self.rewrite_lifetime_def(l)).collect::<Vec<_>>().connect(", "),
99+
t.bound_lifetimes.iter().map(|l| self.rewrite_lifetime_def(l))
100+
.collect::<Vec<_>>().connect(", "),
94101
pprust::path_to_string(&t.trait_ref.path))
95102

96103
} else {

src/visitor.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,9 @@ impl<'a> FmtVisitor<'a> {
380380
}
381381
Some(open_brace) => {
382382
debug!("FmtVisitor::format_mod: internal mod");
383-
debug!("... open_brace: {}, str: {:?}", open_brace, self.codemap.span_to_snippet(s));
383+
debug!("... open_brace: {}, str: {:?}",
384+
open_brace,
385+
self.codemap.span_to_snippet(s));
384386
// Format everything until opening brace
385387
// TODO Shoud rewrite properly
386388
self.format_missing(s.lo + BytePos(open_brace as u32));

0 commit comments

Comments
 (0)