1
Fork 0

rebasing changes and address review comment

This commit is contained in:
Nick Cameron 2015-09-26 14:00:19 +12:00
parent 8dfcb9bcdd
commit d161b8df72
2 changed files with 9 additions and 3 deletions

View file

@ -162,7 +162,10 @@ impl Rewrite for ast::Expr {
offset))
}
ast::Expr_::ExprRet(None) => {
wrap_str("return".to_owned(), context.config.max_width, width, offset)
wrap_str("return".to_owned(),
context.config.max_width,
width,
offset)
}
ast::Expr_::ExprRet(Some(ref expr)) => {
rewrite_unary_prefix(context, "return ", &expr, width, offset)
@ -652,7 +655,10 @@ fn single_line_if_else(context: &RewriteContext,
let fits_line = fixed_cost + pat_expr_str.len() + if_str.len() + else_str.len() <= width;
if fits_line && !if_str.contains('\n') && !else_str.contains('\n') {
return Some(format!("if {} {{ {} }} else {{ {} }}", pat_expr_str, if_str, else_str));
return Some(format!("if {} {{ {} }} else {{ {} }}",
pat_expr_str,
if_str,
else_str));
}
}

View file

@ -26,7 +26,7 @@ pub enum ListTactic {
Horizontal,
// Try Horizontal layout, if that fails then vertical
HorizontalVertical,
// HorizontalVertical with a soft limit.
// HorizontalVertical with a soft limit of n characters.
LimitedHorizontalVertical(usize),
// Pack as many items as possible per row over (possibly) many rows.
Mixed,