&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[3..]
}
// Figure out if the block is necessary.
- let needs_block = block.rules != ast::BlockCheckMode::Default ||
- block.stmts.len() > 1 || context.inside_macro ||
+ let needs_block = block.rules != ast::BlockCheckMode::Default || block.stmts.len() > 1 ||
+ context.inside_macro ||
block_contains_comment(block, context.codemap) ||
prefix.contains('\n');
};
let list_str = try_opt!(write_list(&items[first_index..], &fmt));
- let result =
- if list_str.contains('\n') && context.config.imports_indent() == IndentStyle::Block {
- format!(
- "{}{{\n{}{}\n{}}}",
- path_str,
- nested_shape.indent.to_string(context.config),
- list_str,
- shape.indent.to_string(context.config)
- )
- } else {
- format!("{}{{{}}}", path_str, list_str)
- };
+ let result = if list_str.contains('\n') && context.config.imports_indent() == IndentStyle::Block
+ {
+ format!(
+ "{}{{\n{}{}\n{}}}",
+ path_str,
+ nested_shape.indent.to_string(context.config),
+ list_str,
+ shape.indent.to_string(context.config)
+ )
+ } else {
+ format!("{}{{{}}}", path_str, list_str)
+ };
Some(result)
}
}
let wildcard_suffix_len = count_wildcard_suffix_len(context, &pat_vec, span, shape);
- let (pat_vec, span) =
- if context.config.condense_wildcard_suffixes() && wildcard_suffix_len >= 2 {
- let new_item_count = 1 + pat_vec.len() - wildcard_suffix_len;
- let sp = pat_vec[new_item_count - 1].span();
- let snippet = context.snippet(sp);
- let lo = sp.lo + BytePos(snippet.find_uncommented("_").unwrap() as u32);
- pat_vec[new_item_count - 1] = TuplePatField::Dotdot(mk_sp(lo, lo + BytePos(1)));
- (&pat_vec[..new_item_count], mk_sp(span.lo, lo + BytePos(1)))
- } else {
- (&pat_vec[..], span)
- };
+ let (pat_vec, span) = if context.config.condense_wildcard_suffixes() && wildcard_suffix_len >= 2
+ {
+ let new_item_count = 1 + pat_vec.len() - wildcard_suffix_len;
+ let sp = pat_vec[new_item_count - 1].span();
+ let snippet = context.snippet(sp);
+ let lo = sp.lo + BytePos(snippet.find_uncommented("_").unwrap() as u32);
+ pat_vec[new_item_count - 1] = TuplePatField::Dotdot(mk_sp(lo, lo + BytePos(1)));
+ (&pat_vec[..new_item_count], mk_sp(span.lo, lo + BytePos(1)))
+ } else {
+ (&pat_vec[..], span)
+ };
// add comma if `(x,)`
let add_comma = path_str.is_none() && pat_vec.len() == 1 && dotdot_pos.is_none();
Shape::legacy(max_path_width, shape.indent + extra_offset),
));
- Some(if context.config.spaces_within_angle_brackets() &&
- lifetime_str.len() > 0
- {
- format!("for< {} > {}", lifetime_str, path_str)
- } else {
- format!("for<{}> {}", lifetime_str, path_str)
- })
+ Some(
+ if context.config.spaces_within_angle_brackets() && lifetime_str.len() > 0 {
+ format!("for< {} > {}", lifetime_str, path_str)
+ } else {
+ format!("for<{}> {}", lifetime_str, path_str)
+ },
+ )
} else {
self.trait_ref.rewrite(context, shape)
}
.quux();
a + match x {
- true => "yay!",
- false => "boo!",
- }
- .bar()
+ true => "yay!",
+ false => "boo!",
+ }
+ .bar()
}
fn is_replaced_content() -> bool {