Merge pull request from topecongiro/small-fixes

Small fixes
This commit is contained in:
Nick Cameron 2017-07-20 10:14:51 +12:00 committed by GitHub
commit e6b8ca54bb
16 changed files with 154 additions and 172 deletions

@ -561,7 +561,7 @@ fn choose_first_connector<'a>(
if subexpr_list.is_empty() {
""
} else if extend || subexpr_list.last().map_or(false, is_try) ||
is_extendable_parent(context, parent_str)
is_extendable_parent(context, parent_str)
{
// 1 = ";", being conservative here.
if last_line_width(parent_str) + first_line_width(first_child_str) + 1 <=

@ -124,7 +124,7 @@ fn comment_style(orig: &str, normalize_comments: bool) -> CommentStyle {
CommentStyle::DoubleSlash
}
} else if (orig.starts_with("///") && orig.chars().nth(3).map_or(true, |c| c != '/')) ||
(orig.starts_with("/**") && !orig.starts_with("/**/"))
(orig.starts_with("/**") && !orig.starts_with("/**/"))
{
CommentStyle::TripleSlash
} else if orig.starts_with("//!") || orig.starts_with("/*!") {
@ -314,13 +314,13 @@ fn left_trim_comment_line<'a>(line: &'a str, style: &CommentStyle) -> &'a str {
&line[opener.trim_right().len()..]
}
} else if line.starts_with("/* ") || line.starts_with("// ") || line.starts_with("//!") ||
line.starts_with("///") ||
line.starts_with("** ") || line.starts_with("/*!") ||
(line.starts_with("/**") && !line.starts_with("/**/"))
line.starts_with("///") ||
line.starts_with("** ") || line.starts_with("/*!") ||
(line.starts_with("/**") && !line.starts_with("/**/"))
{
&line[3..]
} else if line.starts_with("/*") || line.starts_with("* ") || line.starts_with("//") ||
line.starts_with("**")
line.starts_with("**")
{
&line[2..]
} else if line.starts_with('*') {
@ -795,7 +795,7 @@ fn remove_comment_header(comment: &str) -> &str {
} else if comment.starts_with("//") {
&comment[2..]
} else if (comment.starts_with("/**") && !comment.starts_with("/**/")) ||
comment.starts_with("/*!")
comment.starts_with("/*!")
{
&comment[3..comment.len() - 2]
} else {

@ -375,7 +375,7 @@ where
}
// Try rewriting the rhs into the remaining space.
let rhs_shape = shape.shrink_left(last_line_width(&result) + suffix.len());
let rhs_shape = shape.offset_left(last_line_width(&result) + suffix.len());
if let Some(rhs_shape) = rhs_shape {
if let Some(rhs_result) = rhs.rewrite(context, rhs_shape) {
// FIXME this should always hold.
@ -572,7 +572,7 @@ fn rewrite_closure_fn_decl(
// 1 = |
let argument_offset = nested_shape.indent + 1;
let arg_shape = try_opt!(nested_shape.shrink_left(1)).visual_indent(0);
let arg_shape = try_opt!(nested_shape.offset_left(1)).visual_indent(0);
let ret_str = try_opt!(fn_decl.output.rewrite(context, arg_shape));
let arg_items = itemize_list(
@ -876,14 +876,7 @@ fn rewrite_block_with_visitor(
}
visitor.visit_block(block);
if visitor.failed && shape.indent.alignment != 0 {
block.rewrite(
context,
Shape::indented(shape.indent.block_only(), context.config),
)
} else {
Some(format!("{}{}", prefix, visitor.buffer))
}
Some(format!("{}{}", prefix, visitor.buffer))
}
impl Rewrite for ast::Block {
@ -1168,7 +1161,7 @@ impl<'a> ControlFlow<'a> {
let constr_shape = if self.nested_if {
// We are part of an if-elseif-else chain. Our constraints are tightened.
// 7 = "} else " .len()
try_opt!(shape.shrink_left(7))
try_opt!(shape.offset_left(7))
} else {
shape
};
@ -1243,7 +1236,7 @@ impl<'a> ControlFlow<'a> {
let block_sep = if self.cond.is_none() && between_kwd_cond_comment.is_some() {
""
} else if context.config.control_brace_style() == ControlBraceStyle::AlwaysNextLine ||
force_newline_brace
force_newline_brace
{
alt_block_sep
} else {
@ -1435,7 +1428,7 @@ fn block_contains_comment(block: &ast::Block, codemap: &CodeMap) -> bool {
// the expression.
pub fn is_simple_block(block: &ast::Block, codemap: &CodeMap) -> bool {
(block.stmts.len() == 1 && stmt_is_expr(&block.stmts[0]) &&
!block_contains_comment(block, codemap))
!block_contains_comment(block, codemap))
}
/// Checks whether a block contains at most one statement or expression, and no comments.
@ -1514,15 +1507,17 @@ fn rewrite_match(
return None;
}
// `match `cond` {`
// 6 = `match `, 2 = ` {`
let cond_shape = match context.config.control_style() {
Style::Legacy => try_opt!(shape.shrink_left(6).and_then(|s| s.sub_width(2))),
Style::Rfc => try_opt!(shape.offset_left(8)),
Style::Rfc => try_opt!(shape.offset_left(6).and_then(|s| s.sub_width(2))),
};
let cond_str = try_opt!(cond.rewrite(context, cond_shape));
let alt_block_sep = String::from("\n") + &shape.indent.block_only().to_string(context.config);
let block_sep = match context.config.control_brace_style() {
ControlBraceStyle::AlwaysNextLine => alt_block_sep.as_str(),
ControlBraceStyle::AlwaysNextLine => &alt_block_sep,
_ if last_line_extendable(&cond_str) => " ",
_ if cond_str.contains('\n') => &alt_block_sep,
_ => " ",
};
@ -1549,45 +1544,6 @@ fn arm_comma(config: &Config, body: &ast::Expr) -> &'static str {
}
}
fn rewrite_match_pattern(
context: &RewriteContext,
pats: &Vec<ptr::P<ast::Pat>>,
guard: &Option<ptr::P<ast::Expr>>,
shape: Shape,
) -> Option<String> {
// Patterns
// 5 = ` => {`
let pat_shape = try_opt!(shape.sub_width(5));
let pat_strs = try_opt!(
pats.iter()
.map(|p| p.rewrite(context, pat_shape))
.collect::<Option<Vec<_>>>()
);
let items: Vec<_> = pat_strs.into_iter().map(ListItem::from_str).collect();
let tactic = definitive_tactic(&items, ListTactic::HorizontalVertical, pat_shape.width);
let fmt = ListFormatting {
tactic: tactic,
separator: " |",
trailing_separator: SeparatorTactic::Never,
shape: pat_shape,
ends_with_newline: false,
config: context.config,
};
let pats_str = try_opt!(write_list(&items, &fmt));
// Guard
let guard_str = try_opt!(rewrite_guard(
context,
guard,
shape,
trimmed_last_line_width(&pats_str),
));
Some(format!("{}{}", pats_str, guard_str))
}
fn rewrite_match_arms(
context: &RewriteContext,
arms: &[ast::Arm],
@ -1677,6 +1633,45 @@ fn rewrite_match_arm(context: &RewriteContext, arm: &ast::Arm, shape: Shape) ->
rewrite_match_body(context, &arm.body, &pats_str, shape, arm.guard.is_some())
}
fn rewrite_match_pattern(
context: &RewriteContext,
pats: &Vec<ptr::P<ast::Pat>>,
guard: &Option<ptr::P<ast::Expr>>,
shape: Shape,
) -> Option<String> {
// Patterns
// 5 = ` => {`
let pat_shape = try_opt!(shape.sub_width(5));
let pat_strs = try_opt!(
pats.iter()
.map(|p| p.rewrite(context, pat_shape))
.collect::<Option<Vec<_>>>()
);
let items: Vec<_> = pat_strs.into_iter().map(ListItem::from_str).collect();
let tactic = definitive_tactic(&items, ListTactic::HorizontalVertical, pat_shape.width);
let fmt = ListFormatting {
tactic: tactic,
separator: " |",
trailing_separator: SeparatorTactic::Never,
shape: pat_shape,
ends_with_newline: false,
config: context.config,
};
let pats_str = try_opt!(write_list(&items, &fmt));
// Guard
let guard_str = try_opt!(rewrite_guard(
context,
guard,
shape,
trimmed_last_line_width(&pats_str),
));
Some(format!("{}{}", pats_str, guard_str))
}
fn rewrite_match_body(
context: &RewriteContext,
body: &ptr::P<ast::Expr>,
@ -1686,7 +1681,8 @@ fn rewrite_match_body(
) -> Option<String> {
let (extend, body) = match body.node {
ast::ExprKind::Block(ref block)
if !is_unsafe_block(block) && is_simple_block(block, context.codemap) => {
if !is_unsafe_block(block) && is_simple_block(block, context.codemap) =>
{
if let ast::StmtKind::Expr(ref expr) = block.stmts[0].node {
(expr.can_be_overflowed(context, 1), &**expr)
} else {
@ -1699,39 +1695,46 @@ fn rewrite_match_body(
let comma = arm_comma(&context.config, body);
let alt_block_sep = String::from("\n") + &shape.indent.block_only().to_string(context.config);
let alt_block_sep = alt_block_sep.as_str();
let is_block = if let ast::ExprKind::Block(..) = body.node {
true
let (is_block, is_empty_block) = if let ast::ExprKind::Block(ref block) = body.node {
(true, is_empty_block(block, context.codemap))
} else {
false
(false, false)
};
let combine_orig_body = |body_str: &str| {
let block_sep = match context.config.control_brace_style() {
ControlBraceStyle::AlwaysNextLine if is_block => alt_block_sep,
_ if has_guard && pats_str.contains('\n') && is_block && body_str != "{}" => {
alt_block_sep
}
_ => " ",
};
Some(format!("{} =>{}{}{}", pats_str, block_sep, body_str, comma))
};
let forbid_same_line = has_guard && pats_str.contains('\n') && !is_empty_block;
let next_line_indent = if is_block {
shape.indent
} else {
shape.indent.block_indent(context.config)
};
let combine_next_line_body = |body_str: &str| {
let indent_str = shape
.indent
.block_indent(context.config)
.to_string(context.config);
if is_block {
return Some(format!(
"{} =>\n{}{}",
pats_str,
next_line_indent.to_string(context.config),
body_str
));
}
let indent_str = shape.indent.to_string(context.config);
let nested_indent_str = next_line_indent.to_string(context.config);
let (body_prefix, body_suffix) = if context.config.wrap_match_arms() {
let comma = if context.config.match_block_trailing_comma() {
","
} else {
""
};
(
"{",
format!("\n{}}}{}", shape.indent.to_string(context.config), comma),
)
("{", format!("\n{}}}{}", indent_str, comma))
} else {
("", String::from(","))
};
@ -1739,8 +1742,9 @@ fn rewrite_match_body(
let block_sep = match context.config.control_brace_style() {
ControlBraceStyle::AlwaysNextLine => format!("{}{}\n", alt_block_sep, body_prefix),
_ if body_prefix.is_empty() => "\n".to_owned(),
_ => " ".to_owned() + body_prefix + "\n",
} + &indent_str;
_ if forbid_same_line => format!("{}{}\n", alt_block_sep, body_prefix),
_ => format!(" {}\n", body_prefix),
} + &nested_indent_str;
Some(format!(
"{} =>{}{}{}",
@ -1753,19 +1757,20 @@ fn rewrite_match_body(
// Let's try and get the arm body on the same line as the condition.
// 4 = ` => `.len()
let orig_arm_shape = shape
let orig_body_shape = shape
.offset_left(extra_offset(&pats_str, shape) + 4)
.and_then(|shape| shape.sub_width(comma.len()));
let orig_body = if let Some(arm_shape) = orig_arm_shape {
let orig_body = if let Some(body_shape) = orig_body_shape {
let rewrite = nop_block_collapse(
format_expr(body, ExprType::Statement, context, arm_shape),
arm_shape.width,
format_expr(body, ExprType::Statement, context, body_shape),
body_shape.width,
);
match rewrite {
Some(ref body_str)
if ((!body_str.contains('\n')) && first_line_width(body_str) <= arm_shape.width) ||
is_block =>
if !forbid_same_line &&
(is_block ||
(!body_str.contains('\n') && body_str.len() <= body_shape.width)) =>
{
return combine_orig_body(body_str);
}
@ -1774,18 +1779,20 @@ fn rewrite_match_body(
} else {
None
};
let orig_budget = orig_arm_shape.map_or(0, |shape| shape.width);
let orig_budget = orig_body_shape.map_or(0, |shape| shape.width);
// Try putting body on the next line and see if it looks better.
let next_line_body_shape =
Shape::indented(shape.indent.block_indent(context.config), context.config);
let next_line_body_shape = Shape::indented(next_line_indent, context.config);
let next_line_body = nop_block_collapse(
format_expr(body, ExprType::Statement, context, next_line_body_shape),
next_line_body_shape.width,
);
match (orig_body, next_line_body) {
(Some(ref orig_str), Some(ref next_line_str))
if prefer_next_line(orig_str, next_line_str) => combine_next_line_body(next_line_str),
if forbid_same_line || prefer_next_line(orig_str, next_line_str) =>
{
combine_next_line_body(next_line_str)
}
(Some(ref orig_str), _) if extend && first_line_width(orig_str) <= orig_budget => {
combine_orig_body(orig_str)
}
@ -2061,23 +2068,7 @@ where
one_line_width,
args_max_width,
force_trailing_comma,
).or_else(|| if context.use_block_indent() {
rewrite_call_args(
context,
args,
args_span,
Shape::indented(
shape.block().indent.block_indent(context.config),
context.config,
),
0,
0,
force_trailing_comma,
)
} else {
None
})
.ok_or(Ordering::Less)?;
).ok_or(Ordering::Less)?;
if !context.use_block_indent() && need_block_indent(&list_str, nested_shape) && !extendable {
let mut new_context = context.clone();
@ -2384,7 +2375,7 @@ pub fn wrap_args_with_parens(
) -> String {
if !context.use_block_indent() ||
(context.inside_macro && !args_str.contains('\n') &&
args_str.len() + paren_overhead(context) <= shape.width) || is_extendable
args_str.len() + paren_overhead(context) <= shape.width) || is_extendable
{
if context.config.spaces_within_parens() && args_str.len() > 0 {
format!("( {} )", args_str)
@ -2410,8 +2401,13 @@ fn span_ends_with_comma(context: &RewriteContext, span: Span) -> bool {
fn rewrite_paren(context: &RewriteContext, subexpr: &ast::Expr, shape: Shape) -> Option<String> {
debug!("rewrite_paren, shape: {:?}", shape);
let paren_overhead = paren_overhead(context);
let sub_shape = try_opt!(shape.sub_width(paren_overhead / 2)).visual_indent(paren_overhead / 2);
let total_paren_overhead = paren_overhead(context);
let paren_overhead = total_paren_overhead / 2;
let sub_shape = try_opt!(
shape
.offset_left(paren_overhead)
.and_then(|s| s.sub_width(paren_overhead))
);
let paren_wrapper = |s: &str| if context.config.spaces_within_parens() && s.len() > 0 {
format!("( {} )", s)
@ -2422,16 +2418,12 @@ fn rewrite_paren(context: &RewriteContext, subexpr: &ast::Expr, shape: Shape) ->
let subexpr_str = try_opt!(subexpr.rewrite(context, sub_shape));
debug!("rewrite_paren, subexpr_str: `{:?}`", subexpr_str);
if subexpr_str.contains('\n') {
if subexpr_str.contains('\n') ||
first_line_width(&subexpr_str) + total_paren_overhead <= shape.width
{
Some(paren_wrapper(&subexpr_str))
} else {
if subexpr_str.len() + paren_overhead <= shape.width {
Some(paren_wrapper(&subexpr_str))
} else {
let sub_shape = try_opt!(shape.offset_left(2));
let subexpr_str = try_opt!(subexpr.rewrite(context, sub_shape));
Some(paren_wrapper(&subexpr_str))
}
None
}
}
@ -2573,7 +2565,7 @@ fn rewrite_struct_lit<'a>(
}
StructLitField::Base(expr) => {
// 2 = ..
expr.rewrite(context, try_opt!(v_shape.shrink_left(2)))
expr.rewrite(context, try_opt!(v_shape.offset_left(2)))
.map(|s| format!("..{}", s))
}
};
@ -2613,8 +2605,8 @@ pub fn wrap_struct_field(
) -> String {
if context.config.struct_lit_style() == IndentStyle::Block &&
(fields_str.contains('\n') ||
context.config.struct_lit_multiline_style() == MultilineStyle::ForceMulti ||
fields_str.len() > one_line_width)
context.config.struct_lit_multiline_style() == MultilineStyle::ForceMulti ||
fields_str.len() > one_line_width)
{
format!(
"\n{}{}\n{}",

@ -501,7 +501,8 @@ fn rewrite_use_list(
fn move_self_to_front(items: &mut Vec<ListItem>) -> bool {
match items
.iter()
.position(|item| item.item.as_ref().map(|x| &x[..]) == Some("self")) {
.position(|item| item.item.as_ref().map(|x| &x[..]) == Some("self"))
{
Some(pos) => {
items[0] = items.remove(pos);
true

@ -280,7 +280,7 @@ impl<'a> FmtVisitor<'a> {
if force_newline_brace {
newline_brace = true;
} else if self.config.fn_brace_style() != BraceStyle::AlwaysNextLine &&
!result.contains('\n')
!result.contains('\n')
{
newline_brace = false;
}
@ -942,11 +942,10 @@ pub fn format_trait(context: &RewriteContext, item: &ast::Item, offset: Indent)
let has_body = !trait_items.is_empty();
let where_density = if (context.config.where_density() == Density::Compressed &&
(!result.contains('\n') ||
context.config.fn_args_layout() == IndentStyle::Block)) ||
(!result.contains('\n') || context.config.fn_args_layout() == IndentStyle::Block)) ||
(context.config.fn_args_layout() == IndentStyle::Block && result.is_empty()) ||
(context.config.where_density() == Density::CompressedIfEmpty && !has_body &&
!result.contains('\n'))
!result.contains('\n'))
{
Density::Compressed
} else {
@ -1079,7 +1078,7 @@ pub fn format_struct_struct(
// 3 = ` {}`, 2 = ` {`.
let overhead = if fields.is_empty() { 3 } else { 2 };
if (context.config.item_brace_style() == BraceStyle::AlwaysNextLine &&
!fields.is_empty()) ||
!fields.is_empty()) ||
context
.config
.max_width()
@ -1247,8 +1246,8 @@ fn format_tuple_struct(
if !where_clause_str.is_empty() && !where_clause_str.contains('\n') &&
(result.contains('\n') ||
offset.block_indent + result.len() + where_clause_str.len() + 1 >
context.config.max_width())
offset.block_indent + result.len() + where_clause_str.len() + 1 >
context.config.max_width())
{
// We need to put the where clause on a new line, but we didn't
// know that earlier, so the where clause will not be indented properly.

@ -368,7 +368,7 @@ where
let inner_item_width = item.inner_as_ref().len();
if !first &&
(item.is_multiline() || !item.post_comment.is_some() ||
inner_item_width + overhead > max_budget)
inner_item_width + overhead > max_budget)
{
return max_width;
}

@ -83,7 +83,7 @@ pub fn rewrite_string<'a>(orig: &str, fmt: &StringFormat<'a>) -> Option<String>
if cur_end < cur_start + MIN_STRING {
cur_end = cur_start + max_chars;
while !(punctuation.contains(graphemes[cur_end - 1]) ||
graphemes[cur_end - 1].trim().is_empty())
graphemes[cur_end - 1].trim().is_empty())
{
if cur_end >= graphemes.len() {
let line = &graphemes[cur_start..].join("");

@ -54,7 +54,7 @@ impl Summary {
pub fn has_no_errors(&self) -> bool {
!(self.has_operational_errors || self.has_parsing_errors || self.has_formatting_errors ||
self.has_diff)
self.has_diff)
}
pub fn add(&mut self, other: Summary) {

@ -56,7 +56,6 @@ pub struct FmtVisitor<'a> {
// FIXME: use an RAII util or closure for indenting
pub block_indent: Indent,
pub config: &'a Config,
pub failed: bool,
pub is_if_else_block: bool,
}
@ -558,15 +557,6 @@ impl<'a> FmtVisitor<'a> {
fn push_rewrite(&mut self, span: Span, rewrite: Option<String>) {
self.format_missing_with_indent(source!(self, span).lo);
self.failed = match rewrite {
Some(ref s)
if s.rewrite(
&self.get_context(),
Shape::indented(self.block_indent, self.config),
).is_none() => true,
None => true,
_ => self.failed,
};
let result = rewrite.unwrap_or_else(|| self.snippet(span));
self.buffer.push_str(&result);
self.last_pos = source!(self, span).hi;
@ -580,7 +570,6 @@ impl<'a> FmtVisitor<'a> {
last_pos: BytePos(0),
block_indent: Indent::empty(),
config: config,
failed: false,
is_if_else_block: false,
}
}
@ -643,12 +632,12 @@ impl<'a> FmtVisitor<'a> {
.take_while(|ppi| {
is_use_item(&***ppi) &&
(!reorder_imports_in_group ||
{
let current = self.codemap.lookup_line_range(item_bound(&ppi));
let in_same_group = current.lo < last.hi + 2;
last = current;
in_same_group
})
{
let current = self.codemap.lookup_line_range(item_bound(&ppi));
let in_same_group = current.lo < last.hi + 2;
last = current;
in_same_group
})
})
.count();
let (use_items, rest) = items_left.split_at(use_item_length);

@ -240,15 +240,9 @@ fn read_config(filename: &str) -> Config {
fn format_file<P: Into<PathBuf>>(filepath: P, config: &Config) -> (FileMap, FormatReport) {
let filepath = filepath.into();
let display_path = filepath.display().to_string();
let input = Input::File(filepath);
let (error_summary, file_map, report) =
let (_error_summary, file_map, report) =
format_input::<io::Stdout>(input, &config, None).unwrap();
assert!(
error_summary.has_no_errors(),
"Encountered errors formatting {}",
display_path
);
return (file_map, report);
}

@ -5,9 +5,9 @@ fn main() {
loop {
if foo {
if ((right_paddle_speed < 0.) &&
(right_paddle.position().y - paddle_size.y / 2. > 5.)) ||
(right_paddle.position().y - paddle_size.y / 2. > 5.)) ||
((right_paddle_speed > 0.) &&
(right_paddle.position().y + paddle_size.y / 2. < game_height as f32 - 5.))
(right_paddle.position().y + paddle_size.y / 2. < game_height as f32 - 5.))
{
foo
}

@ -21,9 +21,9 @@ fn foo() -> bool {
trivial_value,
);
(((((((((aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
a +
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
aaaaa)))))))));
a +
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
aaaaa)))))))));
{
for _ in 0..10 {}
@ -263,9 +263,9 @@ fn returns() {
fn addrof() {
&mut (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb);
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb);
&(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb);
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb);
}
fn casts() {
@ -351,7 +351,7 @@ fn complex_if_else() {
{
ha();
} else if xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +
xxxxxxxxx
xxxxxxxxx
{
yo();
}

@ -4,8 +4,8 @@ fn foo() {
condition__uses_alignment_for_first_if__2
{
} else if condition__no_alignment_for_later_else__0 ||
condition__no_alignment_for_later_else__1 ||
condition__no_alignment_for_later_else__2
condition__no_alignment_for_later_else__1 ||
condition__no_alignment_for_later_else__2
{
};
}

@ -7,7 +7,10 @@ fn main() {
match x
{
aaaaaaaa::Bbbbb::Ccccccccccccc(_, Some(ref x))
if x == "aaaaaaaaaaa aaaaaaa aaaaaa" => Ok(()),
if x == "aaaaaaaaaaa aaaaaaa aaaaaa" =>
{
Ok(())
}
_ => Err(x),
}
}

@ -72,10 +72,10 @@ fn main() {
vec![
a;
(|x| {
let y = x + 1;
let z = y + 1;
z
})(2)
let y = x + 1;
let z = y + 1;
z
})(2)
];
vec![
a;

@ -29,7 +29,10 @@ fn foo() {
}
Patternnnnnnnnnnnnnnnnnnnnnnnnn | Patternnnnnnnnnnnnnnnnnnnnnnnnn
if looooooooooooooooooooooooooooooooooooooooong_guard => meh,
if looooooooooooooooooooooooooooooooooooooooong_guard =>
{
meh
}
// Test that earlier patterns can take the guard space
(aaaa, bbbbb, ccccccc, aaaaa, bbbbbbbb, cccccc, aaaa, bbbbbbbb, cccccc, dddddd) |
@ -387,7 +390,8 @@ fn issue1395() {
fn issue1456() {
Ok(Recording {
artists: match reader
.evaluate(".//mb:recording/mb:artist-credit/mb:name-credit")? {
.evaluate(".//mb:recording/mb:artist-credit/mb:name-credit")?
{
Nodeset(nodeset) => {
let res: Result<Vec<ArtistRef>, ReadError> = nodeset
.iter()