Remove old heuristics from legacy style
This commit is contained in:
parent
9777c0de93
commit
faf45b3a80
27
src/expr.rs
27
src/expr.rs
@ -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 {
|
||||
@ -2075,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();
|
||||
|
@ -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,18 +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;
|
||||
@ -583,7 +570,6 @@ impl<'a> FmtVisitor<'a> {
|
||||
last_pos: BytePos(0),
|
||||
block_indent: Indent::empty(),
|
||||
config: config,
|
||||
failed: false,
|
||||
is_if_else_block: false,
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user